Remove Wikipedia/Wikimedia specific translations
[lhc/web/wiklou.git] / maintenance / rebuildtextindex.php
index 83a4ea9..47d297a 100644 (file)
@@ -1,19 +1,32 @@
 <?php
-# Rebuild search index table from scratch.  This takes several
-# hours, depending on the database size and server configuration.
+/**
+ * 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" );
-$wgTitle = Title::newFromText( "Rebuild text index script" );
+require_once( "rebuildtextindex.inc" );
+
+$database = wfGetDB( DB_MASTER );
+if( !$database instanceof DatabaseMysql ) {
+       print "This script is only for MySQL.\n";
+       exit();
+}
 
-$wgDBuser                      = $wgDBadminuser;
-$wgDBpassword          = $wgDBadminpassword;
+$wgTitle = Title::newFromText( "Rebuild text index script" );
 
-dropTextIndex();
-rebuildTextIndex();
-createTextIndex();
+dropTextIndex( $database );
+rebuildTextIndex( $database );
+createTextIndex( $database );
 
 print "Done.\n";
 exit();
 
-?>
+