From deca410d59a7b56223e4aab24a7e37d881644544 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Tue, 19 Nov 2019 15:30:25 +0100 Subject: [PATCH] Get rid of obsolete method_exists() checks Change-Id: Ic3396537a8bf5dc39fd3bea089ebd2292e1c6be5 --- includes/CiteHooks.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/includes/CiteHooks.php b/includes/CiteHooks.php index 9d5eb7f54..01b53b765 100644 --- a/includes/CiteHooks.php +++ b/includes/CiteHooks.php @@ -268,23 +268,17 @@ class CiteHooks { if ( !$wgCiteStoreReferencesData || $wgCiteCacheRawReferencesOnParse ) { return; } + // if we can, avoid clearing the cache when references were not changed - if ( method_exists( $linksUpdate, 'getAddedProperties' ) - && method_exists( $linksUpdate, 'getRemovedProperties' ) + if ( isset( $linksUpdate->getAddedProperties()['references-1'] ) + || isset( $linksUpdate->getRemovedProperties()['references-1'] ) ) { - $addedProps = $linksUpdate->getAddedProperties(); - $removedProps = $linksUpdate->getRemovedProperties(); - if ( !isset( $addedProps['references-1'] ) - && !isset( $removedProps['references-1'] ) - ) { - return; - } + $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); + $articleID = $linksUpdate->getTitle()->getArticleID(); + $key = $cache->makeKey( Cite::EXT_DATA_KEY, $articleID ); + // delete with reduced hold off period (LinksUpdate uses a master connection) + $cache->delete( $key, WANObjectCache::MAX_COMMIT_DELAY ); } - $cache = MediaWikiServices::getInstance()->getMainWANObjectCache(); - $articleID = $linksUpdate->getTitle()->getArticleID(); - $key = $cache->makeKey( Cite::EXT_DATA_KEY, $articleID ); - // delete with reduced hold off period (LinksUpdate uses a master connection) - $cache->delete( $key, WANObjectCache::MAX_COMMIT_DELAY ); } /**