Allow PHP version check to execute on older versions of PHP
[lhc/web/wiklou.git] / maintenance / update.php
index b6c7ae4..73edda9 100755 (executable)
@@ -123,6 +123,10 @@ class UpdateMediaWiki extends Maintenance {
 
                $this->output( "MediaWiki {$wgVersion} Updater\n\n" );
 
+               foreach ( SpecialVersion::getSoftwareInformation() as $name => $version ) {
+                       $this->output( "{$name}: {$version}\n" );
+               }
+
                wfWaitForSlaves();
 
                if ( !$this->hasOption( 'skip-compat-checks' ) ) {
@@ -243,17 +247,26 @@ 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,
+                               isset( $param['require'] ) ? $param['require'] : false,
+                               isset( $param['withArg'] ) ? $param['withArg'] : false,
+                               isset( $param['shortName'] ) ? $param['shortName'] : false,
                                $param['multiOccurrence'] ?? false
                        );
                }