-#!/usr/bin/php4 -q
+#!/usr/bin/php5 -q
<?php
/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
+ * Copyright (C) 2003-2010 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');
+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:
?>