From: jenkins-bot Date: Thu, 12 Apr 2018 18:56:42 +0000 (+0000) Subject: Merge "maintenance: Document secondary purpose of --server" X-Git-Tag: 1.31.0-rc.0~98 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=9b670fb797813a8ed35750e2c83fe953a10f349e;hp=-c Merge "maintenance: Document secondary purpose of --server" --- 9b670fb797813a8ed35750e2c83fe953a10f349e diff --combined maintenance/Maintenance.php index cb95fa7ca2,624bbae8cc..13fee9c6ca --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@@ -25,7 -25,6 +25,7 @@@ require_once __DIR__ . '/../includes/PHPVersionCheck.php'; wfEntryPointCheck( 'cli' ); +use MediaWiki\Shell\Shell; use Wikimedia\Rdbms\DBReplicationWaitError; /** @@@ -35,10 -34,6 +35,10 @@@ // Define this so scripts can easily find doMaintenance.php define( 'RUN_MAINTENANCE_IF_MAIN', __DIR__ . '/doMaintenance.php' ); + +/** + * @deprecated since 1.31 + */ define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless $maintClass = false; @@@ -513,9 -508,7 +513,9 @@@ abstract class Maintenance $this->addOption( 'memory-limit', 'Set a specific memory limit for the script, ' - . '"max" for no limit or "default" to avoid changing it' + . '"max" for no limit or "default" to avoid changing it', + false, + true ); $this->addOption( 'server', "The protocol and server name to use in URLs, e.g. " . "http://en.wikipedia.org. This is sometimes necessary because " . @@@ -1215,6 -1208,12 +1215,12 @@@ } define( 'MW_DB', $bits[0] ); define( 'MW_PREFIX', $bits[1] ); + } elseif ( isset( $this->mOptions['server'] ) ) { + // Provide the option for site admins to detect and configure + // multiple wikis based on server names. This offers --server + // as alternative to --wiki. + // See https://www.mediawiki.org/wiki/Manual:Wiki_family + $_SERVER['SERVER_NAME'] = $this->mOptions['server']; } if ( !is_readable( $settingsFile ) ) { @@@ -1222,9 -1221,6 +1228,6 @@@ "must exist and be readable in the source directory.\n" . "Use --conf to specify it." ); } - if ( isset( $this->mOptions['server'] ) ) { - $_SERVER['SERVER_NAME'] = $this->mOptions['server']; - } $wgCommandLineMode = true; return $settingsFile; @@@ -1599,12 -1595,12 +1602,12 @@@ // something that can do the relevant syscalls. There are a few // options. Linux and Mac OS X both have "stty size" which does the // job directly. - $retval = false; - $size = wfShellExec( 'stty size', $retval ); - if ( $retval !== 0 ) { + $result = Shell::command( 'stty', 'size' ) + ->execute(); + if ( $result->getExitCode() !== 0 ) { return $default; } - if ( !preg_match( '/^(\d+) (\d+)$/', $size, $m ) ) { + if ( !preg_match( '/^(\d+) (\d+)$/', $result->getStdout(), $m ) ) { return $default; } return [ intval( $m[2] ), intval( $m[1] ) ];