X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fsearch.rebuild_db.php;h=be3453191bb80ac98e232f5c20dadd6b64263016;hb=8526cfe046865202710c548a3a58c7dbddeaee65;hp=1b9917ff5d1a18266978174db05dd43f1e627cea;hpb=b20ef4deed1b6fa6334bc57c0166a88e2beac9e4;p=platal.git diff --git a/bin/search.rebuild_db.php b/bin/search.rebuild_db.php index 1b9917f..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 user_id - FROM auth_user_md5"); +$res = XDB::iterRow('SELECT pid + FROM profiles'); $i = 0; $n = $res->total(); -while ($uid = $res->next()->fetchOneCell()) { - user_reindex($uid); - 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: ?>