r69350 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69349‎ | r69350 | r69351 >
Date:21:46, 14 July 2010
Author:mah
Status:resolved (Comments)
Tags:
Comment:
follow up r69339:
* Add a missing setVaryCookie for consistency
* don't cache result when token is given in ApiFeedWatchlist
Modified paths:
  • /trunk/phase3/includes/api/ApiFeedWatchlist.php (modified) (history)
  • /trunk/phase3/includes/api/ApiParse.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryProtectedTitles.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRevisions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -378,6 +378,7 @@
379379
380380 if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
381381 global $wgUser;
 382+ $this->getMain()->setVaryCookie();
382383 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rc_comment, $title );
383384 }
384385
Index: trunk/phase3/includes/api/ApiParse.php
@@ -188,6 +188,7 @@
189189
190190 if ( !is_null( $params['summary'] ) ) {
191191 $result_array['parsedsummary'] = array();
 192+ $this->getMain()->setVaryCookie();
192193 $result->setContent( $result_array['parsedsummary'], $wgUser->getSkin()->formatComment( $params['summary'], $titleObj ) );
193194 }
194195
@@ -222,6 +223,7 @@
223224 if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
224225 $out = new OutputPage;
225226 $out->addParserOutputNoText( $p_result );
 227+ $this->getMain()->setVaryCookie();
226228 $userSkin = $wgUser->getSkin();
227229 }
228230
Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -211,6 +211,7 @@
212212
213213 if ( $fld_parsedcomment ) {
214214 global $wgUser;
 215+ $this->getMain()->setVaryCookie();
215216 $rev['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->ar_comment, $title );
216217 }
217218 if ( $fld_minor && $row->ar_minor_edit == 1 ) {
Index: trunk/phase3/includes/api/ApiQueryProtectedTitles.php
@@ -102,6 +102,7 @@
103103
104104 if ( isset( $prop['parsedcomment'] ) ) {
105105 global $wgUser;
 106+ $this->getMain()->setVaryCookie();
106107 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->pt_reason, $title );
107108 }
108109
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -272,6 +272,7 @@
273273
274274 if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
275275 global $wgUser;
 276+ $this->getMain()->setVaryCookie();
276277 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rc_comment, $title );
277278 }
278279
Index: trunk/phase3/includes/api/ApiQueryRevisions.php
@@ -395,6 +395,7 @@
396396
397397 if ( $this->fld_parsedcomment ) {
398398 global $wgUser;
 399+ $this->getMain()->setVaryCookie();
399400 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $comment, $title );
400401 }
401402 }
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php
@@ -78,6 +78,9 @@
7979 $fauxReqArr['wlowner'] = $params['wlowner'];
8080 }
8181 if ( !is_null( $params['wltoken'] ) ) {
 82+ // Don't cache tokens
 83+ $this->getMain()->setCachePrivate();
 84+
8285 $fauxReqArr['wltoken'] = $params['wltoken'];
8386 }
8487
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -321,6 +321,7 @@
322322
323323 if ( $this->fld_parsedcomment ) {
324324 global $wgUser;
 325+ $this->getMain()->setVaryCookie();
325326 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rev_comment, $title );
326327 }
327328 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r69357re r69350: token was input, not outputmah22:39, 14 July 2010
r693801.16wmf4: MFT r69347, r69350, r69369, r69379catrope09:41, 15 July 2010
r69932* MFT r69776, and followups r69784, r69928, r69931, and superseded base revis...tstarling08:03, 26 July 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69339API: Make output containing private or user-specific data uncacheable for log...catrope19:00, 14 July 2010

Comments

#Comment by Catrope (talk | contribs)   22:33, 14 July 2010
+				// Don't cache tokens
+				$this->getMain()->setCachePrivate();
+

This misses the point. Not caching tokens pertains to requests that output tokens, not requests that accept them. These are actually cachable requests because the output does not vary for different users requesting the same URL.

#Comment by MarkAHershberger (talk | contribs)   22:40, 14 July 2010

see r69357

Status & tagging log