X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fsearch.rebuild_db.php;h=be3453191bb80ac98e232f5c20dadd6b64263016;hb=8526cfe046865202710c548a3a58c7dbddeaee65;hp=cd7e56c9335dbc9429ab88010c8a13101823080f;hpb=0073747ac81cc9cff9e43847eb008f0e815255f0;p=platal.git diff --git a/bin/search.rebuild_db.php b/bin/search.rebuild_db.php index cd7e56c..be34531 100755 --- a/bin/search.rebuild_db.php +++ b/bin/search.rebuild_db.php @@ -1,7 +1,7 @@ #!/usr/bin/php5 -q debug = 0; // Do not store backtraces +require './connect.db.inc.php'; $res = XDB::iterRow('SELECT pid FROM profiles'); $i = 0; $n = $res->total(); -while ($pid = $res->next()->fetchOneCell()) { - Profile::rebuildSearchTokens($pid); - printf("\r%u / %u", ++$i, $n); +$pids = array(); +while ($pid = $res->next()) { + $pids[] = intval($pid[0]); + ++$i; + if (count($pids) == 100) { + Profile::rebuildSearchTokens($pids); + printf("\r%u / %u", $i, $n); + $pids = array(); + } +} +if (count($pids) > 0) { + Profile::rebuildSearchTokens($pids); + printf("\r%u / %u", $i, $n); } print "done\n"; -// 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: ?>