X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Fcheckdb.php;h=ed564afeebed9d6ab968b0cfd80125b2922dfe5b;hb=015e4a905822dcf0e506e3e8d95878e44c567ef1;hp=a82dfbc16ceb98edce1f82ccecffe095c92c7762;hpb=93b53499adec78fef5d823110e954c4fcc6c5a7c;p=platal.git diff --git a/bin/cron/checkdb.php b/bin/cron/checkdb.php index a82dfbc..ed564af 100755 --- a/bin/cron/checkdb.php +++ b/bin/cron/checkdb.php @@ -1,7 +1,7 @@ #!/usr/bin/php5 -q total() > 0) { - echo "Erreur pour la verification : $comment\n$sql\n\n"; + echo "Erreur pour la vérification : $comment\n$sql\n\n"; echo "|"; while($col = $it->nextField()) { echo "\t" . $col->name . "\t|"; @@ -49,10 +49,26 @@ function check($sql, $comment = '') } } -function info($sql, $comment = '') { +function checkCount($sql, $comment = '') +{ + $count = XDB::rawFetchOneCell($sql); + if ($err = XDB::error()) { + echo $err; + } + if ($count > 0) { + echo "Erreur pour la vérification : $comment\n$sql\n\n"; + echo "|\tTotal\t|\n|\t$count\t|\n\n"; + } +} + +function info($sql, $comment = '', $onlyCounts = false) { global $opt_verbose; if ($opt_verbose) { - check($sql, $comment); + if ($onlyCounts) { + checkCount($sql, $comment); + } else { + check($sql, $comment); + } } } @@ -112,5 +128,12 @@ check("SELECT a.alias AS username, b.alias AS loginbis, b.expire WHERE a.type = 'a_vie'", "Donne la liste des homonymes qui ont un alias égal à leur loginbis depuis plus d'un mois, il est temps de supprimer leur alias."); +// XXX: counts the number of remaining issues due to the merge (to be removed once all merge related issues have been fixed) +info('SELECT COUNT(*) + FROM profile_merge_issues + WHERE issues IS NULL OR issues = \'\'', + 'Dénombre les erreurs dues à la fusion restantes.', + true); + // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>