(bug 18122) Fix fatal require() errors and typo in the README.
[lhc/web/wiklou.git] / maintenance / rebuildall.php
index a9d0a97..ca7e4c0 100644 (file)
@@ -1,42 +1,42 @@
 <?php
-
-# Rebuild link tracking tables from scratch.  This takes several
-# hours, depending on the database size and server configuration.
-
-if ( ! is_readable( "../LocalSettings.php" ) ) {
-       print "A copy of your installation's LocalSettings.php\n" .
-         "must exist in the source directory.\n";
-       exit();
+/**
+ * Rebuild link tracking tables from scratch.  This takes several
+ * hours, depending on the database size and server configuration.
+ *
+ * @file
+ * @todo document
+ * @ingroup Maintenance
+ */
+
+/** */
+require_once( "commandLine.inc" );
+
+#require_once( "rebuildlinks.inc" );
+require_once( "refreshLinks.inc" );
+require_once( "rebuildtextindex.inc" );
+require_once( "rebuildrecentchanges.inc" );
+
+$dbclass = 'Database' . ucfirst( $wgDBtype ) ;
+$database = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
+
+if ($wgDBtype == 'mysql') {
+       print "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n";
+       dropTextIndex( $database );
+       rebuildTextIndex( $database );
+       createTextIndex( $database );
 }
 
-$wgCommandLineMode = true;
-$DP = "../includes";
-require_once( "../LocalSettings.php" );
-require_once( "../AdminSettings.php" );
-
-$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
-ini_set( "include_path", "$IP$sep$include_path" );
-
-require_once( "Setup.php" );
-require_once( "./rebuildlinks.inc" );
-require_once( "./rebuildtextindex.inc" );
-require_once( "./rebuildrecentchanges.inc" );
-$wgTitle = Title::newFromText( "Rebuild links script" );
-set_time_limit(0);
+print "\n\n** Rebuilding recentchanges table:\n";
+rebuildRecentChangesTable();
 
-$wgDBuser                      = $wgDBadminuser;
-$wgDBpassword          = $wgDBadminpassword;
+# Doesn't work anymore
+# rebuildLinkTables();
 
-rebuildLinkTables();
-
-dropTextIndex();
-rebuildTextIndex();
-createTextIndex();
-
-rebuildRecentChangesTablePass1();
-rebuildRecentChangesTablePass2();
+# Use the slow incomplete one instead. It's designed to work in the background
+print "\n\n** Rebuilding links tables -- this can take a long time. It should be safe to abort via ctrl+C if you get bored.\n";
+refreshLinks( 1 );
 
 print "Done.\n";
 exit();
 
-?>
+