From 20b445e22f236e3deb5249021126021fe396f382 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Tue, 28 Mar 2017 14:34:18 -0700 Subject: [PATCH] resourceloader: Avoid deprecated getModifiedHash() in SkinModule Use getDefinitionSummary instead, which uses a single serialisation pass instead of requiring every stage to be a string. This way we don't need to call json_encode and md5() multiple times. getModifiedHash() was deprecated in MediaWiki 1.26. Change-Id: If9e9caa3d12976c99543ad53ab280355b70acb17 --- .../resourceloader/ResourceLoaderSkinModule.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderSkinModule.php b/includes/resourceloader/ResourceLoaderSkinModule.php index 91e63e70aa..d72b3afaf5 100644 --- a/includes/resourceloader/ResourceLoaderSkinModule.php +++ b/includes/resourceloader/ResourceLoaderSkinModule.php @@ -23,8 +23,6 @@ class ResourceLoaderSkinModule extends ResourceLoaderFileModule { - /* Methods */ - /** * @param ResourceLoaderContext $context * @return array @@ -77,13 +75,12 @@ class ResourceLoaderSkinModule extends ResourceLoaderFileModule { return false; } - /** - * @param ResourceLoaderContext $context - * @return string: Hash - */ - public function getModifiedHash( ResourceLoaderContext $context ) { - $logo = $this->getConfig()->get( 'Logo' ); - $logoHD = $this->getConfig()->get( 'LogoHD' ); - return md5( parent::getModifiedHash( $context ) . $logo . json_encode( $logoHD ) ); + public function getDefinitionSummary( ResourceLoaderContext $context ) { + $summary = parent::getDefinitionSummary( $context ); + $summary[] = [ + 'logo' => $this->getConfig()->get( 'Logo' ), + 'logoHD' => $this->getConfig()->get( 'LogoHD' ), + ]; + return $summary; } } -- 2.20.1