X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fupdate.php;h=d84ec5c54bfe1c64e6ba37e2bf385d5055a1ce34;hb=03d2f3006048bc404b40b02838bd9fb9b563cced;hp=fe405364c9063af8cbe8781c45d95abe5c4bd213;hpb=8fc57e9555b704edf883e828878f0120d85a7b1c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/update.php b/maintenance/update.php index fe405364c9..d84ec5c54b 100755 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -28,6 +28,7 @@ require_once __DIR__ . '/Maintenance.php'; use Wikimedia\Rdbms\IMaintainableDatabase; +use Wikimedia\Rdbms\DatabaseSqlite; /** * Maintenance script to run database schema updates. @@ -160,7 +161,8 @@ class UpdateMediaWiki extends Maintenance { $this->fatalError( $text ); } - $this->output( "Going to run database updates for " . wfWikiID() . "\n" ); + $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId(); + $this->output( "Going to run database updates for $dbDomain\n" ); if ( $db->getType() === 'sqlite' ) { /** @var IMaintainableDatabase|DatabaseSqlite $db */ $this->output( "Using SQLite file: '{$db->getDbFilePath()}'\n" ); @@ -247,18 +249,27 @@ class UpdateMediaWiki extends Maintenance { ]; } + /** + * @throws FatalError + * @throws MWException + * @suppress PhanPluginDuplicateConditionalNullCoalescing + */ public function validateParamsAndArgs() { // Allow extensions to add additional params. $params = []; Hooks::run( 'MaintenanceUpdateAddParams', [ &$params ] ); + + // This executes before the PHP version check, so don't use null coalesce (??). + // Keeping this compatible with older PHP versions lets us reach the code that + // displays a more helpful error. foreach ( $params as $name => $param ) { $this->addOption( $name, $param['desc'], - $param['require'] ?? false, - $param['withArg'] ?? false, - $param['shortName'] ?? false, - $param['multiOccurrence'] ?? false + isset( $param['require'] ) ? $param['require'] : false, + isset( $param['withArg'] ) ? $param['withArg'] : false, + isset( $param['shortName'] ) ? $param['shortName'] : false, + isset( $param['multiOccurrence'] ) ? $param['multiOccurrence'] : false ); }