Re-committing 37663 for the new release, per old Wikitech-l discussion.
[lhc/web/wiklou.git] / maintenance / rebuildtextindex.php
1 <?php
2 /**
3 * Rebuild search index table from scratch. This takes several
4 * hours, depending on the database size and server configuration.
5 *
6 * This is only for MySQL (see bug 9905).
7 * Postgres is trigger-based and should never need rebuilding.
8 *
9 * @file
10 * @todo document
11 * @ingroup Maintenance
12 */
13
14 /** */
15 require_once( "commandLine.inc" );
16 require_once( "rebuildtextindex.inc" );
17
18 $database = wfGetDB( DB_MASTER );
19 if( !$database instanceof DatabaseMysql ) {
20 print "This script is only for MySQL.\n";
21 exit();
22 }
23
24 $wgTitle = Title::newFromText( "Rebuild text index script" );
25
26 dropTextIndex( $database );
27 rebuildTextIndex( $database );
28 createTextIndex( $database );
29
30 print "Done.\n";
31 exit();
32
33