X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=maintenance%2FMaintenance.php;h=4d0af5fa78f21de38cd59f03cc0e96845bc767f4;hb=3597e03663453c0596c69cb7f36070bade7ec6af;hp=7e4bf7c043f461400b6a34a76d32334330d1cf5f;hpb=b610a3b617f7616b2f1db12498cbad5aeae12576;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 7e4bf7c043..4d0af5fa78 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; /** @@ -678,7 +679,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 +716,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 ); @@ -1011,7 +1010,7 @@ abstract class Maintenance { // ... append parameters ... if ( $this->mParams ) { - $output .= " [--" . implode( array_keys( $this->mParams ), "|--" ) . "]"; + $output .= " [--" . implode( "|--", array_keys( $this->mParams ) ) . "]"; } // ... and append arguments. @@ -1294,7 +1293,7 @@ abstract class Maintenance { * This function has the same parameters as wfGetDB() * * @param int $db DB index (DB_REPLICA/DB_MASTER) - * @param array $groups default: empty array + * @param string|string[] $groups default: empty array * @param string|bool $wiki default: current wiki * @return IMaintainableDatabase */ @@ -1594,12 +1593,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] ) ];