]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - maintenance/rebuildall.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / maintenance / rebuildall.php
index 826190485dc15934e3f89b1454522f58a5666287..95822ca26938ae081f50779ab9fe51b9a1ac1723 100644 (file)
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  * http://www.gnu.org/copyleft/gpl.html
  *
+ * @file
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/Maintenance.php' );
+require_once __DIR__ . '/Maintenance.php';
 
+/**
+ * Maintenance script that rebuilds link tracking tables from scratch.
+ *
+ * @ingroup Maintenance
+ */
 class RebuildAll extends Maintenance {
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Rebuild links, text index and recent changes";
+               $this->addDescription( 'Rebuild links, text index and recent changes' );
+       }
+
+       public function getDbType() {
+               return Maintenance::DB_ADMIN;
        }
 
        public function execute() {
-               global $wgDBtype;
                // Rebuild the text index
-               if ( $wgDBtype != 'postgres' ) {
-                       $this->output( "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n" );
+               if ( $this->getDB( DB_REPLICA )->getType() != 'postgres' ) {
+                       $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();
                }
@@ -44,7 +54,8 @@ class RebuildAll extends Maintenance {
                $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" );
+               $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();
 
@@ -53,4 +64,4 @@ class RebuildAll extends Maintenance {
 }
 
 $maintClass = "RebuildAll";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;