From: Aaron Schulz Date: Thu, 17 Sep 2015 18:28:53 +0000 (-0700) Subject: Avoid unneeded memcached queries in showPatrolFooter() X-Git-Tag: 1.31.0-rc.0~9986 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=353812e2d0b74f6cce6d155e28d2d3ab4dcfc03f Avoid unneeded memcached queries in showPatrolFooter() Change-Id: I395019e85cbc80df7d77183ccb75b3691949efc6 --- 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; }