From: Timo Tijhof Date: Sat, 6 Oct 2018 03:05:38 +0000 (+0100) Subject: maintenance: Detect "unknown module name" error in manageForeignResources X-Git-Tag: 1.34.0-rc.0~3857^2 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=523ecf7fd2745725404214aaff87c74768193f67;p=lhc%2Fweb%2Fwiklou.git maintenance: Detect "unknown module name" error in manageForeignResources Previously, `manageForeignResources.php update foo` would output "Done!", which is very similar to "... updating foo\nDone!". The module argument is now validated, just like how the action argument was validated already. Change-Id: Ia7c87de5d86b9d1a411485cac43b1529fe88a59f --- diff --git a/maintenance/resources/manageForeignResources.php b/maintenance/resources/manageForeignResources.php index aa22c68dd1..5317b28c4e 100644 --- a/maintenance/resources/manageForeignResources.php +++ b/maintenance/resources/manageForeignResources.php @@ -69,10 +69,15 @@ TEXT file_get_contents( __DIR__ . '/foreign-resources.yaml' ) ); $module = $this->getArg( 1, 'all' ); - foreach ( $registry as $moduleName => $info ) { - if ( $module !== 'all' && $moduleName !== $module ) { - continue; - } + if ( $module === 'all' ) { + $modules = $registry; + } elseif ( isset( $registry[ $module ] ) ) { + $modules = [ $module => $registry[ $module ] ]; + } else { + $this->fatalError( 'Unknown module name.' ); + } + + foreach ( $modules as $moduleName => $info ) { $this->verbose( "\n### {$moduleName}\n\n" ); $destDir = "{$IP}/resources/lib/$moduleName";