One more password bug fix, DisableCounters flag.
[lhc/web/wiklou.git] / maintenance / rebuildIndex.php
1 <?
2
3 # Rebuild the fulltext search indexes. This may take a while
4 # depending on the database size and server configuration.
5
6 global $IP;
7 include_once( "../LocalSettings.php" );
8 include_once( "$IP/Setup.php" );
9 include_once( "$IP/SearchUpdate.php" );
10 set_time_limit(0);
11
12 $wgDBuser = "wikiadmin";
13 $wgDBpassword = $wgDBadminpassword;
14
15 # May run faster if you drop the index; but will break attempts to search
16 # while it's running if you're online.
17 #echo "Dropping index...\n";
18 ##$sql = "ALTER TABLE searchindex DROP INDEX si_title, DROP INDEX si_text";
19 #$res = wfQuery($sql);
20
21 $sql = "SELECT COUNT(*) AS count FROM cur";
22 $res = wfQuery($sql);
23 $s = wfFetchObject($res);
24 echo "Rebuilding index fields for {$s->count} pages...\n";
25 $n = 0;
26
27 $sql = "SELECT cur_id, cur_namespace, cur_title, cur_text FROM cur";
28 $res = wfQuery($sql);
29 while( $s = wfFetchObject($res)) {
30 $u = new SearchUpdate( $s->cur_id, $s->cur_title, $s->cur_text );
31 $u->doUpdate();
32 if ( ( (++$n) % 500) == 0) {
33 echo "$n\n";
34 }
35 }
36 wfFreeResult( $res );
37
38 #echo "Rebuild the index...\n";
39 ##$sql = "ALTER TABLE searchindex ADD FULLTEXT si_title (si_title),
40 ## ADD FULLTEXT si_text (si_text)";
41 #$res = wfQuery($sql);
42
43 print "Done.\n";
44 exit();
45
46 ?>