Moving to GitHub.
[platal.git] / ut / checkdb.php
index fb2c25f..52618fe 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -67,7 +67,17 @@ class CheckDB extends PlTestCase
                 array('SELECT  pa.pid, pa.countryId
                          FROM  profile_addresses AS pa
                     LEFT JOIN  geoloc_countries  AS gc ON (pa.countryId = gc.iso_3166_1_a2)
-                        WHERE  gc.countryFR IS NULL OR gc.countryFR = \'\''),
+                        WHERE  gc.country IS NULL OR gc.country = \'\''),
+
+            'missing nationalities' =>
+                array('SELECT  p.pid, p.nationality1, p.nationality2, p.nationality3
+                         FROM  profiles         AS p
+                    LEFT JOIN  geoloc_countries AS g1 ON (p.nationality1 = g1.iso_3166_1_a2)
+                    LEFT JOIN  geoloc_countries AS g2 ON (p.nationality2 = g2.iso_3166_1_a2)
+                    LEFT JOIN  geoloc_countries AS g3 ON (p.nationality3 = g3.iso_3166_1_a2)
+                        WHERE  (p.nationality1 IS NOT NULL AND (g1.nationality IS NULL OR g1.nationality = \'\'))
+                               OR (p.nationality2 IS NOT NULL AND (g2.nationality IS NULL OR g2.nationality = \'\'))
+                               OR (p.nationality3 IS NOT NULL AND (g3.nationality IS NULL OR g3.nationality = \'\'))'),
 
             'ax_id' =>
                 array('SELECT  pid, hrpid, ax_id, COUNT(ax_id) AS c
@@ -77,11 +87,11 @@ class CheckDB extends PlTestCase
                        HAVING  c > 1'),
 
             'google apps' =>
-                array('SELECT  a.alias, g.g_status, eo.storage
-                         FROM  email_options  AS eo
-                   INNER JOIN  aliases        AS a ON (a.uid = eo.uid AND a.type = \'a_vie\')
-                   INNER JOIN  gapps_accounts AS g ON (g.l_userid = eo.uid)
-                        WHERE  FIND_IN_SET(\'googleapps\', eo.storage) > 0 AND g.g_status != \'active\'')
+                array('SELECT  s.email, g.g_status, r.redirect
+                         FROM  email_redirect_account AS r
+                   INNER JOIN  email_source_account   AS s ON (r.uid = s.uid AND s.type = \'forlife\')
+                   INNER JOIN  gapps_accounts         AS g ON (g.l_userid = r.uid)
+                        WHERE  r.type = \'googleapps\' AND r.flags = \'active\' AND g.g_status != \'active\'')
         );
 
         $tests = array(
@@ -92,9 +102,6 @@ class CheckDB extends PlTestCase
             'profile_education_enum'        => 'name',
             'profile_education_field_enum'  => 'field',
             'profile_job_enum'              => 'name',
-            'profile_job_sector_enum'       => 'name',
-            'profile_job_subsector_enum'    => 'name',
-            'profile_job_subsubsector_enum' => 'name',
             'profile_langskill_enum'        => 'langue_fr',
             'profile_medal_enum'            => 'text',
             'profile_name_enum'             => 'name',
@@ -182,5 +189,5 @@ class CheckDB extends PlTestCase
 
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>