From 8194b2014b7ed58fb7cfa15f5e4522dd5c577837 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 19 May 2015 14:47:33 -0700 Subject: [PATCH] Deprecate $wgEnableParserCache * There is little reason to disable it and one can set $wgParserCacheType if truly needed Change-Id: Iec5fc7729d0f9de67ec2aa6c0e9c2c1e3e0d57ad --- RELEASE-NOTES-1.26 | 2 ++ docs/memcached.txt | 1 - includes/DefaultSettings.php | 9 ++------- includes/Setup.php | 4 ++++ includes/page/WikiPage.php | 16 ++++------------ tests/parser/parserTest.inc | 3 +-- tests/phpunit/includes/parser/NewParserTest.php | 2 +- tests/phpunit/suites/UploadFromUrlTestSuite.php | 4 ++-- 8 files changed, 16 insertions(+), 25 deletions(-) diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index 6f1120e42c..95f68e1272 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -9,6 +9,8 @@ MediaWiki 1.26 is an alpha-quality branch and is not recommended for use in production. === Configuration changes in 1.26 === +* $wgEnableParserCache was deprecated, set $wgParserCacheType to CACHE_NONE + instead if you want to disable the parser cache. === New features in 1.26 === * Change tags can now be hidden in the interface by disabling the associated diff --git a/docs/memcached.txt b/docs/memcached.txt index d18b199e26..ad2307fda0 100644 --- a/docs/memcached.txt +++ b/docs/memcached.txt @@ -152,7 +152,6 @@ Newtalk: Parser Cache: stored in: $parserMemc - controlled by: $wgEnableParserCache key: $wgDBname:pcache:idhash:$pageid-$renderkey!$hash $pageid: id of the page $renderkey: 1 if action=render, 0 otherwise diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 2ea8b294b6..bd0fbc2073 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2369,13 +2369,8 @@ $wgUseFileCache = false; $wgFileCacheDepth = 2; /** - * Keep parsed pages in a cache (objectcache table or memcached) - * to speed up output of the same page viewed by another user with the - * same options. - * - * This can provide a significant speedup for medium to large pages, - * so you probably want to keep it on. Extensions that conflict with the - * parser cache should disable the cache on a per-page basis instead. + * Kept for extension compatibility; see $wgParserCacheType + * @deprecated 1.26 */ $wgEnableParserCache = true; diff --git a/includes/Setup.php b/includes/Setup.php index 1324ed8bbe..46712527aa 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -105,6 +105,10 @@ if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) { $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo"; } +if ( $wgEnableParserCache === false ) { + $wgParserCacheType = CACHE_NONE; +} + // Fix path to icon images after they were moved in 1.24 if ( $wgRightsIcon ) { $wgRightsIcon = str_replace( diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 8ef3063906..913fb0cec7 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1086,10 +1086,7 @@ class WikiPage implements Page, IDBAccessObject { * @return bool */ public function isParserCacheUsed( ParserOptions $parserOptions, $oldid ) { - global $wgEnableParserCache; - - return $wgEnableParserCache - && $parserOptions->getStubThreshold() == 0 + return $parserOptions->getStubThreshold() == 0 && $this->exists() && ( $oldid === null || $oldid === 0 || $oldid === $this->getLatest() ) && $this->getContentHandler()->isParserCacheSupported(); @@ -2166,8 +2163,6 @@ class WikiPage implements Page, IDBAccessObject { * - 'no-change': don't update the article count, ever */ public function doEditUpdates( Revision $revision, User $user, array $options = array() ) { - global $wgEnableParserCache; - $options += array( 'changed' => true, 'created' => false, @@ -2188,12 +2183,9 @@ class WikiPage implements Page, IDBAccessObject { } // Save it to the parser cache - if ( $wgEnableParserCache ) { - $parserCache = ParserCache::singleton(); - $parserCache->save( - $editInfo->output, $this, $editInfo->popts, $editInfo->timestamp, $editInfo->revid - ); - } + ParserCache::singleton()->save( + $editInfo->output, $this, $editInfo->popts, $editInfo->timestamp, $editInfo->revid + ); // Update the links tables and other secondary data if ( $content ) { diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 1cffa20c09..cc0df7ab06 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -155,7 +155,7 @@ class ParserTest { static function setUp() { global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, - $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache, + $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgExtraNamespaces, $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo, $wgExtraInterlanguageLinkPrefixes, $wgLocalInterwikis, $parserMemc, $wgThumbnailScriptPath, $wgScriptPath, @@ -211,7 +211,6 @@ class ParserTest { $wgParserCacheType = CACHE_NONE; } - $wgEnableParserCache = false; DeferredUpdates::clearPendingUpdates(); $wgMemc = wfGetMainCache(); // checks $wgMainCacheType $messageMemc = wfGetMessageCacheStorage(); diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php index 91aad10c02..c7a310367b 100644 --- a/tests/phpunit/includes/parser/NewParserTest.php +++ b/tests/phpunit/includes/parser/NewParserTest.php @@ -91,7 +91,7 @@ class NewParserTest extends MediaWikiTestCase { ); $tmpGlobals['wgForeignFileRepos'] = array(); $tmpGlobals['wgDefaultExternalStore'] = array(); - $tmpGlobals['wgEnableParserCache'] = false; + $tmpGlobals['wgParserCacheType'] = CACHE_NONE; $tmpGlobals['wgCapitalLinks'] = true; $tmpGlobals['wgNoFollowLinks'] = true; $tmpGlobals['wgNoFollowDomainExceptions'] = array(); diff --git a/tests/phpunit/suites/UploadFromUrlTestSuite.php b/tests/phpunit/suites/UploadFromUrlTestSuite.php index d4a7bd362a..e8672501d2 100644 --- a/tests/phpunit/suites/UploadFromUrlTestSuite.php +++ b/tests/phpunit/suites/UploadFromUrlTestSuite.php @@ -18,7 +18,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { protected function setUp() { global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, - $wgEnableParserCache, $wgNamespaceAliases, $wgNamespaceProtection, + $wgParserCacheType, $wgNamespaceAliases, $wgNamespaceProtection, $parserMemc; $tmpGlobals = array(); @@ -56,7 +56,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { $wgNamespaceAliases['Image'] = NS_FILE; $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK; - $wgEnableParserCache = false; + $wgParserCacheType = CACHE_NONE; DeferredUpdates::clearPendingUpdates(); $wgMemc = wfGetMainCache(); $messageMemc = wfGetMessageCacheStorage(); -- 2.20.1