X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=maintenance%2FMaintenance.php;h=9685177b96ba144e7034ed014482d9f69abf5801;hb=a175567e1e3e66a4b0468f492cc20271f9a7f116;hp=1778a7999035896646db407a0562cf6e2adeee30;hpb=3bfcc2a9fe52f045206f465363ac1ba6a843ba69;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 1778a79990..9685177b96 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -25,6 +25,7 @@ require_once __DIR__ . '/../includes/PHPVersionCheck.php'; wfEntryPointCheck( 'cli' ); +use MediaWiki\Shell\Shell; use Wikimedia\Rdbms\DBReplicationWaitError; /** @@ -508,7 +509,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 " . @@ -678,7 +681,7 @@ abstract class Maintenance { * Do some sanity checking and basic setup */ public function setup() { - global $IP, $wgCommandLineMode, $wgRequestTime; + global $IP, $wgCommandLineMode; # Abort if called from a web server # wfIsCLI() is not available yet @@ -715,8 +718,6 @@ abstract class Maintenance { # But sometimes this doesn't seem to be the case. ini_set( 'max_execution_time', 0 ); - $wgRequestTime = microtime( true ); - # Define us as being in MediaWiki define( 'MEDIAWIKI', true ); @@ -1594,12 +1595,12 @@ abstract class Maintenance { // 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] ) ];