X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FconvertExtensionToRegistration.php;h=7c87e1012648b30c65dc4c973d3b30fa444670b7;hb=d5334fe0362de2a8181cf8c47e02f009ec9bbcd1;hp=f9dd58c299e0dbd1dfec08a7f697033289219e00;hpb=f58fa20d9c4cd46a00b17042ba74fb17110b5125;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/convertExtensionToRegistration.php b/maintenance/convertExtensionToRegistration.php old mode 100755 new mode 100644 index f9dd58c299..7c87e10126 --- a/maintenance/convertExtensionToRegistration.php +++ b/maintenance/convertExtensionToRegistration.php @@ -59,6 +59,7 @@ class ConvertExtensionToRegistration extends Maintenance { $this->addArg( 'path', 'Location to the PHP entry point you wish to convert', /* $required = */ true ); $this->addOption( 'skin', 'Whether to write to skin.json', false, false ); + $this->addOption( 'config-prefix', 'Custom prefix for configuration settings', false, true ); } protected function getAllGlobals() { @@ -92,8 +93,15 @@ class ConvertExtensionToRegistration extends Maintenance { $this->dir = dirname( realpath( $this->getArg( 0 ) ) ); $this->json = []; $globalSettings = $this->getAllGlobals(); + $configPrefix = $this->getOption( 'config-prefix', 'wg' ); + if ( $configPrefix !== 'wg' ) { + $this->json['config']['_prefix'] = $configPrefix; + } foreach ( $vars as $name => $value ) { $realName = substr( $name, 2 ); // Strip 'wg' + if ( $realName === false ) { + continue; + } // If it's an empty array that we likely set, skip it if ( is_array( $value ) && count( $value ) === 0 && in_array( $realName, $__settings ) ) { @@ -110,9 +118,14 @@ class ConvertExtensionToRegistration extends Maintenance { $this->noLongerSupportedGlobals[$realName] . '). ' . "Please update the entry point before convert to registration.\n" ); $this->hasWarning = true; - } elseif ( strpos( $name, 'wg' ) === 0 ) { + } elseif ( strpos( $name, $configPrefix ) === 0 ) { // Most likely a config setting - $this->json['config'][$realName] = $value; + $this->json['config'][substr( $name, strlen( $configPrefix ) )] = $value; + } elseif ( $configPrefix !== 'wg' && strpos( $name, 'wg' ) === 0 ) { + // Warn about this + $this->output( 'Warning: Skipped global "' . $name . '" (' . + 'config prefix is "' . $configPrefix . '"). ' . + "Please check that this setting isn't needed.\n" ); } }