Rename WikiPage::isParserCacheUsed to WikiPage::shouldCheckParserCache
authorOri Livneh <ori@wikimedia.org>
Tue, 23 Jun 2015 03:38:43 +0000 (20:38 -0700)
committerOri Livneh <ori@wikimedia.org>
Tue, 23 Jun 2015 03:55:34 +0000 (20:55 -0700)
'isParserCachedUsed' implies that the parser cache usage has already occurred,
and obscures the true purpose of this method, which is to determine whether or
not the requested page *should* be looked up in the parser cache.

Only usage in extensions is in TextExtracts, which I changed to be both
backward- and forward-compatible in If5d5da8eab13.

Change-Id: I7de67937f0e57b1dffb466319192e4d400b867de

includes/content/ContentHandler.php
includes/jobqueue/jobs/RefreshLinksJob.php
includes/page/Article.php
includes/page/WikiPage.php

index b25bf14..468c7e9 100644 (file)
@@ -1023,7 +1023,7 @@ abstract class ContentHandler {
 
        /**
         * Returns true for content models that support caching using the
-        * ParserCache mechanism. See WikiPage::isParserCacheUsed().
+        * ParserCache mechanism. See WikiPage::shouldCheckParserCache().
         *
         * @since 1.21
         *
index 687855a..dec944a 100644 (file)
@@ -185,7 +185,7 @@ class RefreshLinksJob extends Job {
                        // wasted CPU by other apaches or job runners. We don't want to always save to
                        // cache as this can cause high cache I/O and LRU churn when a template changes.
                        if ( $elapsed >= self::PARSE_THRESHOLD_SEC
-                               && $page->isParserCacheUsed( $parserOptions, $revision->getId() )
+                               && $page->shouldCheckParserCache( $parserOptions, $revision->getId() )
                                && $parserOutput->isCacheable()
                        ) {
                                $ctime = wfTimestamp( TS_MW, (int)$start ); // cache time
index f373eaa..450251a 100644 (file)
@@ -574,7 +574,7 @@ class Article implements Page {
                }
 
                # Should the parser cache be used?
-               $useParserCache = $this->mPage->isParserCacheUsed( $parserOptions, $oldid );
+               $useParserCache = $this->mPage->shouldCheckParserCache( $parserOptions, $oldid );
                wfDebug( 'Article::view using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
                if ( $user->getStubThreshold() ) {
                        $this->getContext()->getStats()->increment( 'pcache_miss_stub' );
index ad58421..f7f2528 100644 (file)
@@ -1085,7 +1085,7 @@ class WikiPage implements Page, IDBAccessObject {
         * @param int $oldId
         * @return bool
         */
-       public function isParserCacheUsed( ParserOptions $parserOptions, $oldId ) {
+       public function shouldCheckParserCache( ParserOptions $parserOptions, $oldId ) {
                return $parserOptions->getStubThreshold() == 0
                        && $this->exists()
                        && ( $oldId === null || $oldId === 0 || $oldId === $this->getLatest() )
@@ -1105,7 +1105,7 @@ class WikiPage implements Page, IDBAccessObject {
         */
        public function getParserOutput( ParserOptions $parserOptions, $oldid = null ) {
 
-               $useParserCache = $this->isParserCacheUsed( $parserOptions, $oldid );
+               $useParserCache = $this->shouldCheckParserCache( $parserOptions, $oldid );
                wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
                if ( $parserOptions->getStubThreshold() ) {
                        wfIncrStats( 'pcache.miss.stub' );