From 353812e2d0b74f6cce6d155e28d2d3ab4dcfc03f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 17 Sep 2015 11:28:53 -0700 Subject: [PATCH] Avoid unneeded memcached queries in showPatrolFooter() Change-Id: I395019e85cbc80df7d77183ccb75b3691949efc6 --- includes/page/Article.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/page/Article.php b/includes/page/Article.php index 120aa5cc2b..29a38baee5 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1091,11 +1091,6 @@ class Article implements Page { // to get the recentchanges row belonging to that entry // (with rc_new = 1). - // Check for cached results - if ( $cache->get( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ) ) ) { - return false; - } - if ( $this->mRevision && !RecentChange::isInRCLifespan( $this->mRevision->getTimestamp(), 21600 ) ) { @@ -1104,6 +1099,12 @@ class Article implements Page { return false; } + // Check for cached results + $key = wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ); + if ( $cache->get( $key ) ) { + return false; + } + $dbr = wfGetDB( DB_SLAVE ); $oldestRevisionTimestamp = $dbr->selectField( 'revision', @@ -1129,7 +1130,7 @@ class Article implements Page { } else { // Cache the information we gathered above in case we can't patrol // Don't cache in case we can patrol as this could change - $cache->set( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ), '1' ); + $cache->set( $key, '1' ); } if ( !$rc ) { @@ -1144,7 +1145,7 @@ class Article implements Page { // Cache the information we gathered above in case we can't patrol // Don't cache in case we can patrol as this could change - $cache->set( wfMemcKey( 'NotPatrollablePage', $this->getTitle()->getArticleID() ), '1' ); + $cache->set( $key, '1' ); return false; } -- 2.20.1