-/** */
-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 );
+require_once( dirname(__FILE__) . '/Maintenance.php' );
+
+class RebuildAll extends Maintenance {
+ public function __construct() {
+ parent::__construct();
+ $this->mDescription = "Rebuild links, text index and recent changes";
+ }
+
+ public function execute() {
+ global $wgDBtype;
+ // Rebuild the text index
+ if ( $wgDBtype == 'mysql' ) {
+ $this->output( "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n" );
+ $rebuildText = $this->runChild( 'RebuildTextIndex', 'rebuildtextindex.php' );
+ $rebuildText->execute();
+ }
+
+ // Rebuild RC
+ $this->output( "\n\n** Rebuilding recentchanges table:\n" );
+ $rebuildRC = $this->runChild( 'RebuildRecentchanges', 'rebuildrecentchanges.php' );
+ $rebuildRC->execute();
+
+ // Rebuild link tables
+ $this->output( "\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" );
+ $rebuildLinks = $this->runChild( 'RefreshLinks', 'refreshLinks.php' );
+ $rebuildLinks->execute();
+
+ $this->output( "Done.\n" );
+ }