From: Kunal Mehta Date: Tue, 13 Sep 2016 06:32:06 +0000 (-0700) Subject: ChangeTags: Skip caching if some hooks aren't registered X-Git-Tag: 1.31.0-rc.0~5611^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=ee81cf7b5905bd684e1307513868aa02885f7def;p=lhc%2Fweb%2Fwiklou.git ChangeTags: Skip caching if some hooks aren't registered There is caching around the ChangeTagsListActive and ListDefinedTags hooks that can be skipped if no callers are registered for them. Change-Id: I0c8fccc358f80536fff7ad0bda1cab09181bca41 --- diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index c8c50736d0..a6e4e78ddc 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -1132,6 +1132,9 @@ class ChangeTags { * @since 1.25 */ public static function listExtensionActivatedTags() { + if ( !Hooks::isRegistered( 'ChangeTagsListActive' ) ) { + return []; + } return ObjectCache::getMainWANInstance()->getWithSetCallback( wfMemcKey( 'active-tags' ), WANObjectCache::TTL_MINUTE * 5, @@ -1207,6 +1210,9 @@ class ChangeTags { * @since 1.25 */ public static function listExtensionDefinedTags() { + if ( !Hooks::isRegistered( 'ListDefinedTags' ) ) { + return []; + } return ObjectCache::getMainWANInstance()->getWithSetCallback( wfMemcKey( 'valid-tags-hook' ), WANObjectCache::TTL_MINUTE * 5,