From 96d25f6bcc0d6f8c67ff96fe72a2a64a8b8412cc Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 5 Jun 2018 01:56:54 +0100 Subject: [PATCH] resourceloader: Remove support for Module::getModifiedTime() and getModifiedHash() Deprecated since 1.26. No subclasses in Wikimedia Git define these methods, no calls to methods by this name in Wikimedia Git. If a module subclass were to still define such a method, it is simply not called anymore. The version hash system introduced in 1.26 will still invalidate modules based on wgCacheEpoch. Bug: T94074 Change-Id: I65b2a625a30f22c8a9d14a3505605546fa5bab83 --- RELEASE-NOTES-1.32 | 2 + .../resourceloader/ResourceLoaderModule.php | 39 ------------------- .../ResourceLoaderModuleTest.php | 2 - 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 11e306a32f..3d22f36502 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -140,6 +140,8 @@ because of Phabricator reports. were removed. Use the ParserCache class instead. * ScopedCallback (deprecated in 1.28) was removed. Use Wikimedia\ScopedCallback instead. +* Support for ResourceLoaderModule::getModifiedTime() and getModifiedHash(), + deprecated since 1.26, was removed. Use getDefinitionSummary() instead. === Deprecations in 1.32 === * Use of a StartProfiler.php file is deprecated in favour of placing diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index a0a4e5865a..609abb8f2f 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -799,11 +799,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { * This method should be quick because it is frequently run by ResourceLoaderStartUpModule to * propagate changes to the client and effectively invalidate cache. * - * For backward-compatibility, the following optional data providers are automatically included: - * - * - getModifiedTime() - * - getModifiedHash() - * * @since 1.26 * @param ResourceLoaderContext $context * @return string Hash (should use ResourceLoader::makeHash) @@ -833,18 +828,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { throw new LogicException( 'getDefinitionSummary must call parent method' ); } $str = json_encode( $summary ); - - $mtime = $this->getModifiedTime( $context ); - if ( $mtime !== null ) { - // Support: MediaWiki 1.25 and earlier - $str .= strval( $mtime ); - } - - $mhash = $this->getModifiedHash( $context ); - if ( $mhash !== null ) { - // Support: MediaWiki 1.25 and earlier - $str .= strval( $mhash ); - } } $this->versionHash[$contextHash] = ResourceLoader::makeHash( $str ); @@ -915,28 +898,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { ]; } - /** - * Get this module's last modification timestamp for a given context. - * - * @deprecated since 1.26 Use getDefinitionSummary() instead - * @param ResourceLoaderContext $context - * @return int|null UNIX timestamp - */ - public function getModifiedTime( ResourceLoaderContext $context ) { - return null; - } - - /** - * Helper method for providing a version hash to getVersionHash(). - * - * @deprecated since 1.26 Use getDefinitionSummary() instead - * @param ResourceLoaderContext $context - * @return string|null Hash - */ - public function getModifiedHash( ResourceLoaderContext $context ) { - return null; - } - /** * Check whether this module is known to be empty. If a child class * has an easy and cheap way to determine that this module is diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php index c917882a50..0ea4e2bd63 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php @@ -4,8 +4,6 @@ class ResourceLoaderModuleTest extends ResourceLoaderTestCase { /** * @covers ResourceLoaderModule::getVersionHash - * @covers ResourceLoaderModule::getModifiedTime - * @covers ResourceLoaderModule::getModifiedHash */ public function testGetVersionHash() { $context = $this->getResourceLoaderContext(); -- 2.20.1