From d06aaa9b20774c5db6d6a6a13d76445b7b914129 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 16 May 2015 13:45:24 +0200 Subject: [PATCH] Do not allow setting deprecated $wgSpecialPageGroups over extension.json $wgSpecialPageGroups is deprecated since 1.21 The code should be migrated to override SpecialPage::getGroupName before adding an extension.json to the extension, instead of allowing setting this over extension.json Also added a warning to convertExtensionToRegistration.php for the no longer supported global Change-Id: Idccbe41b649de93548c5b0fca03145da716bcc65 --- docs/extension.schema.json | 4 ---- includes/registration/ExtensionProcessor.php | 1 - .../convertExtensionToRegistration.php | 19 ++++++++++++++++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/extension.schema.json b/docs/extension.schema.json index 8e8b23b63e..0b45007491 100644 --- a/docs/extension.schema.json +++ b/docs/extension.schema.json @@ -568,10 +568,6 @@ "type": "object", "description": "SpecialPages implemented in this extension (mapping of page name to class name)" }, - "SpecialPageGroups": { - "type": "object", - "description": "Mapping of special page name to group it belongs to" - }, "AutoloadClasses": { "type": "object" }, diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index 23a2993ec9..0f359c8bfe 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -29,7 +29,6 @@ class ExtensionProcessor implements Processor { 'ExtensionFunctions', 'ExtensionEntryPointListFiles', 'SpecialPages', - 'SpecialPageGroups', 'JobClasses', 'LogTypes', 'LogRestrictions', diff --git a/maintenance/convertExtensionToRegistration.php b/maintenance/convertExtensionToRegistration.php index 06370e92de..e6523d02c9 100644 --- a/maintenance/convertExtensionToRegistration.php +++ b/maintenance/convertExtensionToRegistration.php @@ -25,6 +25,15 @@ class ConvertExtensionToRegistration extends Maintenance { 'TrackingCategories', ); + /** + * No longer supported globals (with reason) should not be converted and emit a warning + * + * @var array + */ + protected $noLongerSupportedGlobals = array( + 'SpecialPageGroups' => 'deprecated', + ); + /** * Keys that should be put at the top of the generated JSON file (T86608) * @@ -42,7 +51,7 @@ class ConvertExtensionToRegistration extends Maintenance { 'type', ); - private $json, $dir; + private $json, $dir, $hasWarning = false; public function __construct() { parent::__construct(); @@ -83,6 +92,11 @@ class ConvertExtensionToRegistration extends Maintenance { call_user_func_array( array( $this, $this->custom[$realName] ), array( $realName, $value, $vars ) ); } elseif ( in_array( $realName, $globalSettings ) ) { $this->json[$realName] = $value; + } elseif ( array_key_exists( $realName, $this->noLongerSupportedGlobals ) ) { + $this->output( 'Warning: Skipped global "' . $name . '" (' . + $this->noLongerSupportedGlobals[$realName] . '). ' . + "Please update the entry point before convert to registration.\n" ); + $this->hasWarning = true; } elseif ( strpos( $name, 'wg' ) === 0 ) { // Most likely a config setting $this->json['config'][$realName] = $value; @@ -104,6 +118,9 @@ class ConvertExtensionToRegistration extends Maintenance { $prettyJSON = FormatJson::encode( $out, "\t", FormatJson::ALL_OK ); file_put_contents( $fname, $prettyJSON . "\n" ); $this->output( "Wrote output to $fname.\n" ); + if ( $this->hasWarning ) { + $this->output( "Found warnings! Please resolve the warnings and rerun this script.\n" ); + } } protected function handleExtensionFunctions( $realName, $value ) { -- 2.20.1