/**
* 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();
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
*/
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
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;
if ( wfIsWindows() ) {
return $default;
}
+ if ( Shell::isDisabled() ) {
+ return $default;
+ }
// It's possible to get the screen size with VT-100 terminal escapes,
// but reading the responses is not possible without setting raw mode
// (unless you want to require the user to press enter), and that