From 7746dd3eb521c2e5bc99c08fd879bd125e2da2fc Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Tue, 17 Aug 2021 10:33:43 -0700 Subject: [PATCH] Deprecate use of template directory relative to core Warning now issued since skins have been updated. Additional change: Previously deprecations in release notes were in the wrong section (Relating to ResourceLoaderSkinModule) these are moved alongside the newly added deprecation note alongside other skin deprecations. Bug: T262067 Depends-On: I52bee67732cc72ec6857b6fc10cfbdd89ef9b8db Depends-On: I338198878e78cb5c6f47c53fdf18d3944655e965 Change-Id: Ic60524fe3c054706dbea15cc04235e979952e9f5 --- RELEASE-NOTES-1.37 | 2 ++ includes/registration/ExtensionProcessor.php | 5 ++++- .../phpunit/includes/registration/ExtensionProcessorTest.php | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES-1.37 b/RELEASE-NOTES-1.37 index 91373e79db3..e1b53252ecb 100644 --- a/RELEASE-NOTES-1.37 +++ b/RELEASE-NOTES-1.37 @@ -675,6 +675,8 @@ because of Phabricator reports. BaseTemplateAfterPortlet hook, which were deprecated in 1.35, now emit deprecation warnings. * The LocalFile::getHistory() hook is deprecated. +* Previously the Skin templateDirectory option inside skin.json had to be + relative to MediaWiki core. This should now be relative to the skin. * Calling WikiPage::prepareContentForEdit() without a UserIdentity is now deprecated. * User::getEditTokenObject(), ::getEditToken(), and ::matchEditToken() were each diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index b6b4212b976..92982763cf4 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -638,8 +638,11 @@ class ExtensionProcessor implements Processor { if ( is_dir( $correctedPath ) ) { $data['args'][0]['templateDirectory'] = $correctedPath; } else { - // TODO: deprecate directories relative to core. $data['args'][0]['templateDirectory'] = $templateDirectory; + wfDeprecatedMsg( + 'Template directory should be relative to skin or omitted.', + '1.37' + ); } } elseif ( isset( $data['args'][0] ) ) { // If not set, we set a sensible default. diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php b/tests/phpunit/includes/registration/ExtensionProcessorTest.php index 9fe702f2343..d1c675f9b23 100644 --- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php +++ b/tests/phpunit/includes/registration/ExtensionProcessorTest.php @@ -63,6 +63,7 @@ class ExtensionProcessorTest extends MediaWikiIntegrationTestCase { } public function testExtractSkins() { + $this->expectDeprecation(); $processor = new ExtensionProcessor(); $processor->extractInfo( $this->dir, self::$default + [ 'ValidSkinNames' => [