X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27votes%27%2C%20votes=%27waiting%27%29%20%7D%7D?a=blobdiff_plain;f=maintenance%2FmergeMessageFileList.php;h=7d85259ef9fefa89f177c99ae431140d2c2c4409;hb=371bdcad7c0af0e746c3dcbba9d61d4749436ebc;hp=a650aa0b0efc51e0e72182b839781afc1a2d6caf;hpb=f43fa6f4f0e2cb60b8543daad661b48a3e0653a9;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/mergeMessageFileList.php b/maintenance/mergeMessageFileList.php index a650aa0b0e..7d85259ef9 100644 --- a/maintenance/mergeMessageFileList.php +++ b/maintenance/mergeMessageFileList.php @@ -36,11 +36,6 @@ $mmfl = false; * @ingroup Maintenance */ class MergeMessageFileList extends Maintenance { - /** - * @var bool - */ - protected $hasError; - function __construct() { parent::__construct(); $this->addOption( @@ -57,17 +52,16 @@ class MergeMessageFileList extends Maintenance { } public function execute() { - // @codingStandardsIgnoreStart Ignore error: Global variable "$mmfl" is lacking 'wg' prefix + // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix global $mmfl; - // @codingStandardsIgnoreEnd global $wgExtensionEntryPointListFiles; if ( !count( $wgExtensionEntryPointListFiles ) && !$this->hasOption( 'list-file' ) && !$this->hasOption( 'extensions-dir' ) ) { - $this->error( "Either --list-file or --extensions-dir must be provided if " . - "\$wgExtensionEntryPointListFiles is not set", 1 ); + $this->fatalError( "Either --list-file or --extensions-dir must be provided if " . + "\$wgExtensionEntryPointListFiles is not set" ); } $mmfl = [ 'setupFiles' => [] ]; @@ -85,30 +79,29 @@ class MergeMessageFileList extends Maintenance { $extdirs = explode( ':', $extdir ); $entries = []; foreach ( $extdirs as $extdir ) { - $entries = array_merge( $entries, scandir( $extdir ) ); - } - foreach ( $entries as $extname ) { - if ( $extname == '.' || $extname == '..' || !is_dir( "$extdir/$extname" ) ) { - continue; - } - $possibilities = [ - "$extdir/$extname/extension.json", - "$extdir/$extname/skin.json", - "$extdir/$extname/$extname.php" - ]; - $found = false; - foreach ( $possibilities as $extfile ) { - if ( file_exists( $extfile ) ) { - $mmfl['setupFiles'][] = $extfile; - $found = true; - break; + $entries = scandir( $extdir ); + foreach ( $entries as $extname ) { + if ( $extname == '.' || $extname == '..' || !is_dir( "$extdir/$extname" ) ) { + continue; + } + $possibilities = [ + "$extdir/$extname/extension.json", + "$extdir/$extname/skin.json", + "$extdir/$extname/$extname.php" + ]; + $found = false; + foreach ( $possibilities as $extfile ) { + if ( file_exists( $extfile ) ) { + $mmfl['setupFiles'][] = $extfile; + $found = true; + break; + } } - } - if ( !$found ) { - $this->hasError = true; - $this->error( "Extension {$extname} in {$extdir} lacks expected entry point: " . - "extension.json, skin.json, or {$extname}.php." ); + if ( !$found ) { + $this->error( "Extension {$extname} in {$extdir} lacks expected entry point: " . + "extension.json, skin.json, or {$extname}.php." ); + } } } } @@ -119,10 +112,6 @@ class MergeMessageFileList extends Maintenance { $mmfl['setupFiles'] = array_merge( $mmfl['setupFiles'], $extensionPaths ); } - if ( $this->hasError ) { - $this->error( "Some files are missing (see above). Giving up.", 1 ); - } - if ( $this->hasOption( 'output' ) ) { $mmfl['output'] = $this->getOption( 'output' ); }