Merge "Fix 'Tags' padding to keep it farther from the edge and document the source...
[lhc/web/wiklou.git] / maintenance / Maintenance.php
index 13fee9c..245bb47 100644 (file)
@@ -202,6 +202,11 @@ abstract class Maintenance {
 
        /**
         * Do the actual work. All child classes will need to implement this
+        *
+        * @return bool|null True for success, false for failure. Not returning
+        *   a value, or returning null, is also interpreted as success. Returning
+        *   false for failure will cause doMaintenance.php to exit the process
+        *   with a non-zero exit status.
         */
        abstract public function execute();
 
@@ -533,6 +538,7 @@ abstract class Maintenance {
                if ( $this->getDbType() > 0 ) {
                        $this->addOption( 'dbuser', 'The DB user to use for this script', false, true );
                        $this->addOption( 'dbpass', 'The password to use for this script', false, true );
+                       $this->addOption( 'dbgroupdefault', 'The default DB group to use.', false, true );
                }
 
                # Save additional script dependant options to display
@@ -1113,7 +1119,7 @@ abstract class Maintenance {
         */
        public function finalSetup() {
                global $wgCommandLineMode, $wgShowSQLErrors, $wgServer;
-               global $wgDBadminuser, $wgDBadminpassword;
+               global $wgDBadminuser, $wgDBadminpassword, $wgDBDefaultGroup;
                global $wgDBuser, $wgDBpassword, $wgDBservers, $wgLBFactoryConf;
 
                # Turn off output buffering again, it might have been turned on in the settings files
@@ -1135,6 +1141,11 @@ abstract class Maintenance {
                if ( $this->mDbPass ) {
                        $wgDBadminpassword = $this->mDbPass;
                }
+               if ( $this->hasOption( 'dbgroupdefault' ) ) {
+                       $wgDBDefaultGroup = $this->getOption( 'dbgroupdefault', null );
+
+                       MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->destroy();
+               }
 
                if ( $this->getDbType() == self::DB_ADMIN && isset( $wgDBadminuser ) ) {
                        $wgDBuser = $wgDBadminuser;