diff --git a/checkin_notes b/checkin_notes index 54db0b7bac..690406a92b 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4011,3 +4011,12 @@ David 23 May 2012 configure.ac lib/ network.h + +David 23 May 2012 + - server: make fix_venue.php work faster + + html/ + inc/ + boinc_db.inc + ops/ + fix_venue.php diff --git a/html/inc/boinc_db.inc b/html/inc/boinc_db.inc index 4d58b237dd..cfada1c92f 100644 --- a/html/inc/boinc_db.inc +++ b/html/inc/boinc_db.inc @@ -120,6 +120,10 @@ class BoincUser { $db = BoincDb::get(); return $db->count('user', $clause); } + static function max($field) { + $db = BoincDb::get(); + return $db->max('user', $field); + } function update($clause) { $db = BoincDb::get(); return $db->update($this, 'user', $clause); diff --git a/html/ops/fix_venue.php b/html/ops/fix_venue.php index f91399cfc0..37ca61f241 100644 --- a/html/ops/fix_venue.php +++ b/html/ops/fix_venue.php @@ -1,7 +1,11 @@ tag before closing +// - \" instead of " require_once("../inc/boinc_db.inc"); @@ -9,6 +13,9 @@ require_once("../inc/boinc_db.inc"); // This fixes an XML error introduced at some point in the past // function repair_prefs($prefs) { + if (strstr($prefs, '\"')) { + return str_replace('\"', '"', $prefs); + } $x = strstr($prefs, "", true); if (!$x) return null; return "$x\n \n\n"; @@ -24,18 +31,18 @@ function process_set($users) { if ($retval) { //echo "$user->id: good\n"; } else { - echo "$user->id: prefs don't parse\n"; + echo "repairing prefs for user $user->id\n"; $p = repair_prefs($user->global_prefs); if ($p) { $retval = @simplexml_load_string($p); if ($retval) { $user->update("global_prefs='$p'"); - echo "repair succeeded for $user->id\n"; + echo " repair succeeded\n"; } else { - echo "couldn't repair prefs for user $user->id\n"; + echo " repair failed\n"; } } else { - echo "bad prefs for user $user->id\n"; + echo " prefs are missing end tag\n"; } } } @@ -43,11 +50,13 @@ function process_set($users) { $n = 0; -while (1) { - $users = BoincUser::enum("true limit $n,1000"); - echo "processing from $n\n"; +$maxid = BoincUser::max("id"); +while ($n <= $maxid) { + $m = $n + 1000; + $users = BoincUser::enum("id >= $n and id < $m"); + //echo "processing from $n\n"; if (!$users) break; process_set($users); - $n += sizeof($users); + $n = $m; } ?>