Browse Source

Minor improvement to count_report presentation - refs BT#4882

Yannick Warnier 12 years ago
parent
commit
1bcf762e11
1 changed files with 8 additions and 4 deletions
  1. 8 4
      tests/migrate/count_report.php

+ 8 - 4
tests/migrate/count_report.php

@@ -1,5 +1,9 @@
 <?php
 require '../../main/inc/global.inc.php';
+$eol = "<br />\n";
+if (PHP_SAPI == 'cli') {
+  $eol = "\n";
+}
 $tables = array(
   'user',
   'course',
@@ -8,16 +12,16 @@ $tables = array(
   'session_rel_course_rel_user',
   'gradebook_category',
 );
-echo "\n--- Post-migration count report ---\n";
+echo "$eol--- Post-migration count report ---$eol";
 foreach ($tables as $table) {
   $sql = "SELECT count(*) FROM $table";
   $res = Database::query($sql);
   if ($res === false) {
-    echo "SQL error in ".$sql."\n";
+    echo "SQL error in ".$sql.$eol;
   } else {
     $row = Database::fetch_array($res);
     $count = $row[0];
-    echo "Table $table has $count items after migration\n";
+    echo "Table $table has $count items after migration$eol";
   }
 }
-echo "\n";
+echo 'The end.'.$eol;