Output more MW version info in update.php
[lhc/web/wiklou.git] / maintenance / update.php
index 2a1feb4..fe40536 100755 (executable)
@@ -64,7 +64,7 @@ class UpdateMediaWiki extends Maintenance {
        function compatChecks() {
                $minimumPcreVersion = Installer::MINIMUM_PCRE_VERSION;
 
-               list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
+               $pcreVersion = explode( ' ', PCRE_VERSION, 2 )[0];
                if ( version_compare( $pcreVersion, $minimumPcreVersion, '<' ) ) {
                        $this->fatalError(
                                "PCRE $minimumPcreVersion or later is required.\n" .
@@ -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' ) ) {
@@ -242,6 +246,24 @@ class UpdateMediaWiki extends Maintenance {
                        'manualRecache' => false,
                ];
        }
+
+       public function validateParamsAndArgs() {
+               // Allow extensions to add additional params.
+               $params = [];
+               Hooks::run( 'MaintenanceUpdateAddParams', [ &$params ] );
+               foreach ( $params as $name => $param ) {
+                       $this->addOption(
+                               $name,
+                               $param['desc'],
+                               $param['require'] ?? false,
+                               $param['withArg'] ?? false,
+                               $param['shortName'] ?? false,
+                               $param['multiOccurrence'] ?? false
+                       );
+               }
+
+               parent::validateParamsAndArgs();
+       }
 }
 
 $maintClass = UpdateMediaWiki::class;