X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fsearch.rebuild_db.php;h=5e43d31ad12fceeeadadb295960c696f8d13df6b;hb=d3766f1a389558a8b6cf0febf5dd84ad5a40bb82;hp=baa738f38d401e8efcb770b7dea4d6720bbc3acc;hpb=50a40a33a496131e817df875607ea5542d096a64;p=platal.git diff --git a/bin/search.rebuild_db.php b/bin/search.rebuild_db.php index baa738f..5e43d31 100755 --- a/bin/search.rebuild_db.php +++ b/bin/search.rebuild_db.php @@ -1,7 +1,7 @@ -#!/usr/bin/php4 -q +#!/usr/bin/php5 -q xdb->execute('DELETE FROM search_name'); +ini_set('memory_limit', '16M'); +$globals->debug = 0; // Do not store backtraces -$res = $globals->xdb->iterRow('SELECT auth_user_md5.user_id, nom, prenom, nom_usage, profile_nick FROM auth_user_md5 LEFT JOIN auth_user_quick USING(user_id)'); +$res = XDB::iterRow('SELECT pid + FROM profiles'); $i = 0; -$muls = array(1,1,1,0.2); -while ($tmp = $res->next()) { - $uid = array_shift($tmp); - _user_reindex($uid, $tmp, $muls); - printf ("%02.2f %%\n", ++$i*100/$res->total()); +$n = $res->total(); +while ($pid = $res->next()) { + Profile::rebuildSearchTokens(intval($pid[0])); + printf("\r%u / %u", ++$i, $n); } +print "done\n"; + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>