From b6d43206a671122ac9fb7e8897182782a1d1f274 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 16 Dec 2016 11:32:26 -0800 Subject: [PATCH] registration: Always specify version number in extension.schema.json file Instead of having the current version of the schema live at extension.schema.json, always include a version number in it. This simplifies both the code, and makes merging, cherry-picks, rebasing, etc. easier when the current schema version changes. Change-Id: I1b5ef4ced1eb34b8bdda7ba9b3f086b1997b704c --- docs/{extension.schema.json => extension.schema.v2.json} | 0 includes/registration/ExtensionJsonValidator.php | 6 +----- .../includes/registration/ExtensionProcessorTest.php | 3 ++- 3 files changed, 3 insertions(+), 6 deletions(-) rename docs/{extension.schema.json => extension.schema.v2.json} (100%) diff --git a/docs/extension.schema.json b/docs/extension.schema.v2.json similarity index 100% rename from docs/extension.schema.json rename to docs/extension.schema.v2.json diff --git a/includes/registration/ExtensionJsonValidator.php b/includes/registration/ExtensionJsonValidator.php index f6e76af557..8142111b82 100644 --- a/includes/registration/ExtensionJsonValidator.php +++ b/includes/registration/ExtensionJsonValidator.php @@ -75,11 +75,7 @@ class ExtensionJsonValidator { } $version = $data->manifest_version; - if ( $version !== ExtensionRegistry::MANIFEST_VERSION ) { - $schemaPath = __DIR__ . "/../../docs/extension.schema.v$version.json"; - } else { - $schemaPath = __DIR__ . '/../../docs/extension.schema.json'; - } + $schemaPath = __DIR__ . "/../../docs/extension.schema.v$version.json"; // Not too old if ( $version < ExtensionRegistry::OLDEST_MANIFEST_VERSION ) { diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php b/tests/phpunit/includes/registration/ExtensionProcessorTest.php index 11995de944..71f760dced 100644 --- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php +++ b/tests/phpunit/includes/registration/ExtensionProcessorTest.php @@ -450,8 +450,9 @@ class ExtensionProcessorTest extends MediaWikiTestCase { $globalSettings = TestingAccessWrapper::newFromClass( ExtensionProcessor::class )->globalSettings; + $version = ExtensionRegistry::MANIFEST_VERSION; $schema = FormatJson::decode( - file_get_contents( "$IP/docs/extension.schema.json" ), + file_get_contents( "$IP/docs/extension.schema.v$version.json" ), true ); $missing = []; -- 2.20.1