X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fsearch.rebuild_db.php;h=be3453191bb80ac98e232f5c20dadd6b64263016;hb=3424387cde6c635ff16c3b5459c4caa88bb76e2e;hp=5e43d31ad12fceeeadadb295960c696f8d13df6b;hpb=2f62eba70f87d629498e5ed3b95e669bd383846a;p=platal.git diff --git a/bin/search.rebuild_db.php b/bin/search.rebuild_db.php index 5e43d31..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 - $res = XDB::iterRow('SELECT pid FROM profiles'); $i = 0; $n = $res->total(); +$pids = array(); while ($pid = $res->next()) { - Profile::rebuildSearchTokens(intval($pid[0])); - printf("\r%u / %u", ++$i, $n); + $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: ?>