summaryrefslogtreecommitdiff
path: root/maintenance/rebuildtextindex.php
blob: 47d297a9bb28d8857b2e25f4fa3d16ca4d82cabe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
 * Rebuild search index table from scratch.  This takes several
 * hours, depending on the database size and server configuration.
 *
 * This is only for MySQL (see bug 9905). For postgres we can probably
 * use SearchPostgres::update($pageid);
 *
 * @todo document
 * @addtogroup Maintenance
 */

/** */
require_once( "commandLine.inc" );
require_once( "rebuildtextindex.inc" );

$database = wfGetDB( DB_MASTER );
if( !$database instanceof DatabaseMysql ) {
	print "This script is only for MySQL.\n";
	exit();
}

$wgTitle = Title::newFromText( "Rebuild text index script" );

dropTextIndex( $database );
rebuildTextIndex( $database );
createTextIndex( $database );

print "Done.\n";
exit();