r72883 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72882‎ | r72883 | r72884 >
Date:19:26, 12 September 2010
Author:ialex
Status:ok
Tags:
Comment:
Removed trailing spaces
Modified paths:
  • /trunk/phase3/includes/parser/ParserCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/ParserCache.php
@@ -37,14 +37,14 @@
3838 }
3939 $this->mMemc = $memCached;
4040 }
41 -
 41+
4242 protected function getParserOutputKey( $article, $hash ) {
4343 global $wgRequest;
44 -
 44+
4545 // idhash seem to mean 'page id' + 'rendering hash' (r3710)
4646 $pageid = $article->getID();
4747 $renderkey = (int)($wgRequest->getVal('action') == 'render');
48 -
 48+
4949 $key = wfMemcKey( 'pcache', 'idhash', "{$pageid}-{$renderkey}!{$hash}" );
5050 return $key;
5151 }
@@ -55,17 +55,17 @@
5656 }
5757
5858 /**
59 - * Provides an E-Tag suitable for the whole page. Note that $article
60 - * is just the main wikitext. The E-Tag has to be unique to the whole
61 - * page, even if the article itself is the same, so it uses the
62 - * complete set of user options. We don't want to use the preference
63 - * of a different user on a message just because it wasn't used in
64 - * $article. For example give a Chinese interface to a user with
65 - * English preferences. That's why we take into account *all* user
 59+ * Provides an E-Tag suitable for the whole page. Note that $article
 60+ * is just the main wikitext. The E-Tag has to be unique to the whole
 61+ * page, even if the article itself is the same, so it uses the
 62+ * complete set of user options. We don't want to use the preference
 63+ * of a different user on a message just because it wasn't used in
 64+ * $article. For example give a Chinese interface to a user with
 65+ * English preferences. That's why we take into account *all* user
6666 * options. (r70809 CR)
6767 */
6868 function getETag( $article, $popts ) {
69 - return 'W/"' . $this->getParserOutputKey( $article,
 69+ return 'W/"' . $this->getParserOutputKey( $article,
7070 $popts->optionsHash( ParserOptions::legacyOptions() ) ) .
7171 "--" . $article->mTouched . '"';
7272 }
@@ -80,19 +80,19 @@
8181
8282 /**
8383 * Used to provide a unique id for the PoolCounter.
84 - * It would be preferable to have this code in get()
 84+ * It would be preferable to have this code in get()
8585 * instead of having Article looking in our internals.
86 - *
 86+ *
8787 * Precondition: $article->checkTouched() has been called.
8888 */
8989 public function getKey( $article, $popts, $useOutdated = true ) {
9090 global $wgCacheEpoch;
91 -
 91+
9292 if( $popts instanceof User ) {
9393 wfWarn( "Use of outdated prototype ParserCache::getKey( &\$article, &\$user )\n" );
9494 $popts = ParserOptions::newFromUser( $popts );
9595 }
96 -
 96+
9797 // Determine the options which affect this article
9898 $optionsKey = $this->mMemc->get( $this->getOptionsKey( $article ) );
9999 if ( $optionsKey != false ) {
@@ -102,12 +102,12 @@
103103 wfDebug( "Parser options key expired, touched {$article->mTouched}, epoch $wgCacheEpoch, cached $cacheTime\n" );
104104 return false;
105105 }
106 -
 106+
107107 $usedOptions = $optionsKey->mUsedOptions;
108108 wfDebug( "Parser cache options found.\n" );
109109 } else {
110110 # TODO: Fail here $wgParserCacheExpireTime after deployment unless $useOutdated
111 -
 111+
112112 $usedOptions = ParserOptions::legacyOptions();
113113 }
114114
@@ -131,7 +131,7 @@
132132
133133 // Having called checkTouched() ensures this will be loaded
134134 $touched = $article->mTouched;
135 -
 135+
136136 $parserOutputKey = $this->getKey( $article, $popts, $useOutdated );
137137 if ( $parserOutputKey === false ) {
138138 wfProfileOut( __METHOD__ );
@@ -147,7 +147,7 @@
148148 }
149149
150150 wfDebug( "Found.\n" );
151 -
 151+
152152 if ( !$useOutdated && $value->expired( $touched ) ) {
153153 wfIncrStats( "pcache_miss_expired" );
154154 $cacheTime = $value->getCacheTime();
@@ -168,13 +168,13 @@
169169 public function save( $parserOutput, $article, $popts ) {
170170 $expire = $parserOutput->getCacheExpiry();
171171
172 - if( $expire > 0 ) {
 172+ if( $expire > 0 ) {
173173 $now = wfTimestampNow();
174174
175 - $optionsKey = new CacheTime;
 175+ $optionsKey = new CacheTime;
176176 $optionsKey->mUsedOptions = $popts->usedOptions();
177177 $optionsKey->updateCacheExpiry( $expire );
178 -
 178+
179179 $optionsKey->setCacheTime( $now );
180180 $parserOutput->setCacheTime( $now );
181181

Status & tagging log