-#!/usr/bin/php4 -q
+#!/usr/bin/php5 -q
<?php
/***************************************************************************
- * Copyright (C) 2003-2004 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require('./connect.db.inc.php');
-require('user.func.inc.php');
+require './connect.db.inc.php';
-ini_set('memory_limit', "16M");
-$globals->xdb->execute('DELETE FROM search_name');
-
-$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();
+$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:
?>