r69578 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69577‎ | r69578 | r69579 >
Date:02:46, 20 July 2010
Author:tstarling
Status:deferred (Comments)
Tags:
Comment:
Revert backport of broken bug fix for the API cache header bug. Reverted r69354 and related backports r69355, r69357, r69367, r69370.
Modified paths:
  • /branches/REL1_16/extensions/AbuseFilter/ApiQueryAbuseFilters.php (modified) (history)
  • /branches/REL1_16/extensions/AbuseFilter/ApiQueryAbuseLog.php (modified) (history)
  • /branches/REL1_16/extensions/CentralAuth/ApiQueryGlobalUserInfo.php (modified) (history)
  • /branches/REL1_16/extensions/CodeReview/api/ApiCodeComments.php (modified) (history)
  • /branches/REL1_16/extensions/CodeReview/api/ApiCodeDiff.php (modified) (history)
  • /branches/REL1_16/extensions/CodeReview/api/ApiCodeUpdate.php (modified) (history)
  • /branches/REL1_16/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php (modified) (history)
  • /branches/REL1_16/extensions/GlobalBlocking/ApiQueryGlobalBlocks.php (modified) (history)
  • /branches/REL1_16/extensions/LiquidThreads/api/ApiQueryLQTThreads.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/ballots/Ballot.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/crypt/Crypt.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/crypt/Random.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/entities/Election.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/entities/Entity.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/entities/Option.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/entities/Question.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/main/Base.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/main/Context.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/main/Store.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/DetailsPage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/DumpPage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/EntryPage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/ListPage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/LoginPage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/MessageDumpPage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/Page.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/TallyPage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/TranslatePage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/pages/VotePage.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/talliers/ElectionTallier.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/talliers/Tallier.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/user/Auth.php (modified) (history)
  • /branches/REL1_16/extensions/SecurePoll/includes/user/Voter.php (modified) (history)
  • /branches/REL1_16/extensions/UsabilityInitiative/ClickTracking/ApiClickTracking.php (modified) (history)
  • /branches/REL1_16/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js (modified) (history)
  • /branches/REL1_16/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiLogout.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiMain.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiParse.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiPatrol.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiPurge.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryAllmessages.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryBlocks.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryDeletedrevs.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryInfo.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryProtectedTitles.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryRevisions.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryUserInfo.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryUsers.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiQueryWatchlistRaw.php (modified) (history)
  • /branches/REL1_16/phase3/includes/api/ApiWatch.php (modified) (history)

Diff [purge]

Index: branches/REL1_16/extensions/CodeReview/api/ApiCodeDiff.php
@@ -4,7 +4,6 @@
55
66 public function execute() {
77 global $wgUser, $wgCodeReviewMaxDiffSize;
8 - $this->getMain()->setVaryCookie();
98 // Before doing anything at all, let's check permissions
109 if( !$wgUser->isAllowed('codereview-use') ) {
1110 $this->dieUsage('You don\'t have permission to view code diffs','permissiondenied');
Index: branches/REL1_16/extensions/CodeReview/api/ApiCodeUpdate.php
@@ -8,7 +8,6 @@
99 if( !$wgUser->isAllowed('codereview-use') ) {
1010 $this->dieUsage('You don\'t have permission update code','permissiondenied');
1111 }
12 - $this->getMain()->setVaryCookie();
1312 $params = $this->extractRequestParams();
1413
1514 if ( !isset( $params['repo'] ) ) {
Index: branches/REL1_16/extensions/CodeReview/api/ApiCodeComments.php
@@ -30,7 +30,6 @@
3131
3232 public function execute() {
3333 global $wgUser;
34 - $this->getMain()->setVaryCookie();
3534 // Before doing anything at all, let's check permissions
3635 if( !$wgUser->isAllowed('codereview-use') ) {
3736 $this->dieUsage('You don\'t have permission to view code comments','permissiondenied');
Property changes on: branches/REL1_16/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js
___________________________________________________________________
Deleted: svn:mergeinfo
Index: branches/REL1_16/extensions/UsabilityInitiative/ClickTracking/ApiClickTracking.php
@@ -15,7 +15,6 @@
1616 public function execute() {
1717 global $wgUser, $wgTitle, $wgClickTrackContribGranularity1, $wgClickTrackContribGranularity2, $wgClickTrackContribGranularity3;
1818
19 - $this->getMain()->setCachePrivate();
2019 $params = $this->extractRequestParams();
2120 $this->validateParams( $params );
2221 $eventid_to_lookup = $params['eventid'];
Index: branches/REL1_16/extensions/LiquidThreads/api/ApiQueryLQTThreads.php
@@ -43,6 +43,8 @@
4444 }
4545
4646 public function execute() {
 47+ global $wgUser;
 48+
4749 $params = $this->extractRequestParams();
4850 $prop = array_flip( $params['prop'] );
4951 $result = $this->getResult();
@@ -84,7 +86,6 @@
8587 );
8688
8789 $this->addFields( $allFields );
88 - $this->getMain()->setVaryCookie();
8990 }
9091
9192 $res = $this->select( __METHOD__ );
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/user/Voter.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/user/Auth.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/DetailsPage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/DumpPage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/TallyPage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/LoginPage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/MessageDumpPage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/ListPage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/TranslatePage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/VotePage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/Page.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/pages/EntryPage.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/talliers/ElectionTallier.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/talliers/Tallier.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/ballots/Ballot.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/crypt/Random.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/crypt/Crypt.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/entities/Question.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/entities/Option.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/entities/Entity.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/entities/Election.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/main/Store.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/main/Context.php
___________________________________________________________________
Deleted: svn:mergeinfo
Property changes on: branches/REL1_16/extensions/SecurePoll/includes/main/Base.php
___________________________________________________________________
Deleted: svn:mergeinfo
Index: branches/REL1_16/extensions/CentralAuth/ApiQueryGlobalUserInfo.php
@@ -41,7 +41,6 @@
4242 $prop = array_flip( (array)$params['prop'] );
4343 if ( is_null( $params['user'] ) ) {
4444 $params['user'] = $wgUser->getName();
45 - $this->getMain()->setVaryCookie();
4645 }
4746 $user = new CentralAuthUser( $params['user'] );
4847 if ( !$user->exists() ) {
Index: branches/REL1_16/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php
@@ -58,7 +58,6 @@
5959 $this->addWhere( 'GREATEST(page_len,rev_len)-LEAST(page_len,rev_len) <= '.
6060 intval($params['maxsize']) );
6161 if( $params['filterwatched'] == 'watched' ) {
62 - $this->getMain()->setVaryCookie();
6362 if( !($uid = $wgUser->getId()) ) {
6463 $this->dieUsage('You must be logged-in to have a watchlist', 'notloggedin');
6564 }
@@ -83,7 +82,7 @@
8483 $this->addWhere( 'rev_id=fp_stable' );
8584 if ( !isset( $params['start'] ) && !isset( $params['end'] ) )
8685 $this->addWhere( 'fp_pending_since IS NOT NULL' );
87 -
 86+
8887 $this->addOption( 'USE INDEX', $useIndex );
8988
9089 if ( is_null( $resultPageSet ) ) {
Index: branches/REL1_16/extensions/AbuseFilter/ApiQueryAbuseLog.php
@@ -36,7 +36,6 @@
3737
3838 public function execute() {
3939 global $wgUser;
40 - $this->getMain()->setVaryCookie();
4140 if ( !$wgUser->isAllowed( 'abusefilter-log' ) )
4241 $this->dieUsage( 'You don\'t have permission to view the abuse log', 'permissiondenied' );
4342
Index: branches/REL1_16/extensions/AbuseFilter/ApiQueryAbuseFilters.php
@@ -36,7 +36,6 @@
3737
3838 public function execute() {
3939 global $wgUser;
40 - $this->getMain()->setVaryCookie();
4140 if ( !$wgUser->isAllowed( 'abusefilter-view' ) )
4241 $this->dieUsage( 'You don\'t have permission to view abuse filters', 'permissiondenied' );
4342
Index: branches/REL1_16/extensions/GlobalBlocking/ApiQueryGlobalBlocks.php
@@ -36,6 +36,7 @@
3737 }
3838
3939 public function execute() {
 40+ global $wgUser;
4041 $params = $this->extractRequestParams();
4142
4243 $prop = array_flip($params['prop']);
Index: branches/REL1_16/phase3/includes/api/ApiQueryRecentChanges.php
@@ -137,12 +137,8 @@
138138
139139 // Check permissions
140140 global $wgUser;
141 - if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
142 - $this->getMain()->setVaryCookie();
143 - if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) {
144 - $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
145 - }
146 - }
 141+ if ( ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() )
 142+ $this->dieUsage( "You need the patrol right to request the patrolled flag", 'permissiondenied' );
147143
148144 /* Add additional conditions to query depending upon parameters. */
149145 $this->addWhereIf( 'rc_minor = 0', isset ( $show['!minor'] ) );
@@ -394,9 +390,6 @@
395391
396392 if ( !is_null( $this->token ) )
397393 {
398 - // Don't cache tokens
399 - $this->getMain()->setCachePrivate();
400 -
401394 $tokenFunctions = $this->getTokenFunctions();
402395 foreach ( $this->token as $t )
403396 {
Index: branches/REL1_16/phase3/includes/api/ApiQueryProtectedTitles.php
@@ -100,7 +100,6 @@
101101
102102 if ( isset( $prop['parsedcomment'] ) ) {
103103 global $wgUser;
104 - $this->getMain()->setVaryCookie();
105104 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->pt_reason, $title );
106105 }
107106
Index: branches/REL1_16/phase3/includes/api/ApiLogout.php
@@ -42,7 +42,6 @@
4343
4444 public function execute() {
4545 global $wgUser;
46 - $this->getMain()->setCachePrivate();
4746 $oldName = $wgUser->getName();
4847 $wgUser->logout();
4948
Index: branches/REL1_16/phase3/includes/api/ApiMain.php
@@ -124,7 +124,7 @@
125125
126126 private $mPrinter, $mModules, $mModuleNames, $mFormats, $mFormatNames;
127127 private $mResult, $mAction, $mShowVersions, $mEnableWrite, $mRequest;
128 - private $mInternalMode, $mSquidMaxage, $mModule, $mVaryCookie;
 128+ private $mInternalMode, $mSquidMaxage, $mModule;
129129
130130 private $mCacheControl = array( 'must-revalidate' => true );
131131
@@ -171,7 +171,6 @@
172172
173173 $this->mSquidMaxage = - 1; // flag for executeActionWithErrorHandling()
174174 $this->mCommit = false;
175 - $this->mVaryCookie = false;
176175 }
177176
178177 /**
@@ -222,14 +221,6 @@
223222 's-maxage' => $maxage
224223 ) );
225224 }
226 -
227 - /**
228 - * Make sure Cache-Control: private is set. Use this when the output of a request
229 - * is for the current recipient only and should not be cached in any shared cache.
230 - */
231 - public function setCachePrivate() {
232 - $this->setCacheControl( array( 'private' => true ) );
233 - }
234225
235226 /**
236227 * Set directives (key/value pairs) for the Cache-Control header.
@@ -241,35 +232,6 @@
242233 }
243234
244235 /**
245 - * Make sure Vary: Cookie and friends are set. Use this when the output of a request
246 - * may be cached for anons but may not be cached for logged-in users.
247 - *
248 - * WARNING: This function must be called CONSISTENTLY for a given URL. This means that a
249 - * given URL must either always or never call this function; if it sometimes does and
250 - * sometimes doesn't, stuff will break.
251 - */
252 - public function setVaryCookie() {
253 - $this->mVaryCookie = true;
254 - }
255 -
256 - /**
257 - * Actually output the Vary: Cookie header and its friends, if flagged with setVaryCookie().
258 - * Outputs the appropriate X-Vary-Options header and Cache-Control: private if needed.
259 - */
260 - private function outputVaryCookieHeader() {
261 - global $wgUseXVO, $wgOut;
262 - if ( $this->mVaryCookie ) {
263 - header( 'Vary: Cookie' );
264 - if ( $wgUseXVO ) {
265 - header( $wgOut->getXVO() );
266 - if ( $wgOut->haveCacheVaryCookies() ) {
267 - $this->setCacheControl( array( 'private' => true ) );
268 - }
269 - }
270 - }
271 - }
272 -
273 - /**
274236 * Create an instance of an output formatter by its name
275237 */
276238 public function createPrinterByName( $format ) {
@@ -319,7 +281,6 @@
320282
321283 // Error results should not be cached
322284 $this->setCacheMaxAge( 0 );
323 - $this->setCachePrivate();
324285
325286 $headerStr = 'MediaWiki-API-Error: ' . $errCode;
326287 if ( $e->getCode() === 0 )
@@ -334,11 +295,6 @@
335296 $this->mPrinter->safeProfileOut();
336297 $this->printResult( true );
337298 }
338 -
339 - // If this wiki is private, don't cache anything ever
340 - if ( in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) ) {
341 - $this->setCachePrivate();
342 - }
343299
344300 // If nobody called setCacheMaxAge(), use the (s)maxage parameters
345301 if ( !isset( $this->mCacheControl['s-maxage'] ) ) {
@@ -370,7 +326,6 @@
371327 }
372328
373329 header( "Cache-Control: $ccHeader" );
374 - $this->outputVaryCookieHeader();
375330
376331 if ( $this->mPrinter->getIsHtml() )
377332 echo wfReportTime();
@@ -491,8 +446,7 @@
492447 }
493448
494449 global $wgUser, $wgGroupPermissions;
495 - if ( $module->isReadMode() && !in_array( 'read', User::getGroupPermissions( array( '*' ) ), true ) &&
496 - !$wgUser->isAllowed( 'read' ) )
 450+ if ( $module->isReadMode() && !$wgGroupPermissions['*']['read'] && !$wgUser->isAllowed( 'read' ) )
497451 $this->dieUsageMsg( array( 'readrequired' ) );
498452 if ( $module->isWriteMode() ) {
499453 if ( !$this->mEnableWrite )
Index: branches/REL1_16/phase3/includes/api/ApiQueryWatchlistRaw.php
@@ -61,7 +61,6 @@
6262 if ( isset( $show['changed'] ) && isset( $show['!changed'] ) )
6363 $this->dieUsageMsg( array( 'show' ) );
6464
65 - $this->getMain()->setVaryCookie();
6665 $this->addTables( 'watchlist' );
6766 $this->addFields( array( 'wl_namespace', 'wl_title' ) );
6867 $this->addFieldsIf( 'wl_notificationtimestamp', isset( $prop['changed'] ) );
@@ -189,4 +188,4 @@
190189 public function getVersion() {
191190 return __CLASS__ . ': $Id$';
192191 }
193 -}
 192+}
\ No newline at end of file
Index: branches/REL1_16/phase3/includes/api/ApiQueryUserInfo.php
@@ -40,7 +40,6 @@
4141 }
4242
4343 public function execute() {
44 - $this->getMain()->setCachePrivate();
4544 $params = $this->extractRequestParams();
4645 $result = $this->getResult();
4746 $r = array();
Index: branches/REL1_16/phase3/includes/api/ApiQueryLogEvents.php
@@ -267,7 +267,6 @@
268268
269269 if ( $this->fld_parsedcomment ) {
270270 global $wgUser;
271 - $this->getMain()->setVaryCookie();
272271 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->log_comment, $title );
273272 }
274273 }
Index: branches/REL1_16/phase3/includes/api/ApiQueryBlocks.php
@@ -121,12 +121,8 @@
122122 'ipb_auto' => 0
123123 ) );
124124 }
125 -
126 - // Make sure private data (deleted blocks) isn't cached
127 - $this->getMain()->setVaryCookie();
128 - if ( !$wgUser->isAllowed( 'hideuser' ) ) {
 125+ if ( !$wgUser->isAllowed( 'hideuser' ) )
129126 $this->addWhereFld( 'ipb_deleted', 0 );
130 - }
131127
132128 // Purge expired entries on one in every 10 queries
133129 if ( !mt_rand( 0, 10 ) )
Index: branches/REL1_16/phase3/includes/api/ApiQueryInfo.php
@@ -244,7 +244,6 @@
245245 $this->getProtectionInfo();
246246
247247 if ( $this->fld_watched )
248 - $this->getMain()->setVaryCookie();
249248 $this->getWatchedInfo();
250249
251250 // Run the talkid/subjectid query if requested
@@ -289,9 +288,6 @@
290289 }
291290
292291 if ( !is_null( $this->params['token'] ) ) {
293 - // Don't cache tokens
294 - $this->getMain()->setCachePrivate();
295 -
296292 $tokenFunctions = $this->getTokenFunctions();
297293 $pageInfo['starttimestamp'] = wfTimestamp( TS_ISO_8601, time() );
298294 foreach ( $this->params['token'] as $t )
@@ -526,7 +522,7 @@
527523 }
528524
529525 /**
530 - * Get information about watched status and put it in $this->watched
 526+ * Get information about watched status and put it in $watched
531527 */
532528 private function getWatchedInfo()
533529 {
Index: branches/REL1_16/phase3/includes/api/ApiQueryWatchlist.php
@@ -68,12 +68,9 @@
6969 if ( $token == '' || $token != $params['token'] ) {
7070 $this->dieUsage( 'Incorrect watchlist token provided -- please set a correct token in Special:Preferences', 'bad_wltoken' );
7171 }
 72+ } elseif ( !$wgUser->isLoggedIn() ) {
 73+ $this->dieUsage( 'You must be logged-in to have a watchlist', 'notloggedin' );
7274 } else {
73 - // User not determined by URL, so don't cache
74 - $this->getMain()->setVaryCookie();
75 - if ( !$wgUser->isLoggedIn() ) {
76 - $this->dieUsage( 'You must be logged-in to have a watchlist', 'notloggedin' );
77 - }
7875 $user = $wgUser;
7976 }
8077
@@ -93,8 +90,7 @@
9491 $this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
9592
9693 if ( $this->fld_patrol ) {
97 - $this->getMain()->setVaryCookie();
98 - if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
 94+ if ( !$user->useRCPatrol() && !$user->useNPPatrol() )
9995 $this->dieUsage( 'patrol property is not available', 'patrol' );
10096 }
10197 }
@@ -159,12 +155,8 @@
160156 }
161157
162158 // Check permissions. FIXME: should this check $user instead of $wgUser?
163 - if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
164 - $this->getMain()->setVaryCookie();
165 - if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) {
166 - $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
167 - }
168 - }
 159+ if ( ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) && !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() )
 160+ $this->dieUsage( "You need the patrol right to request the patrolled flag", 'permissiondenied' );
169161
170162 /* Add additional conditions to query depending upon parameters. */
171163 $this->addWhereIf( 'rc_minor = 0', isset ( $show['!minor'] ) );
@@ -280,8 +272,6 @@
281273
282274 if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
283275 global $wgUser;
284 - $this->getMain()->setVaryCookie();
285 -
286276 $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rc_comment, $title );
287277 }
288278
Index: branches/REL1_16/phase3/includes/api/ApiQueryDeletedrevs.php
@@ -42,7 +42,6 @@
4343 public function execute() {
4444
4545 global $wgUser;
46 - $this->getMain()->setVaryCookie();
4746 // Before doing anything at all, let's check permissions
4847 if ( !$wgUser->isAllowed( 'deletedhistory' ) )
4948 $this->dieUsage( 'You don\'t have permission to view deleted revision information', 'permissiondenied' );
Index: branches/REL1_16/phase3/includes/api/ApiPatrol.php
@@ -41,7 +41,6 @@
4242 * Patrols the article or provides the reason the patrol failed.
4343 */
4444 public function execute() {
45 - $this->getMain()->setCachePrivate();
4645 $params = $this->extractRequestParams();
4746
4847 if ( !isset( $params['rcid'] ) )
Index: branches/REL1_16/phase3/includes/api/ApiWatch.php
@@ -41,8 +41,7 @@
4242
4343 public function execute() {
4444 global $wgUser;
45 - $this->getMain()->setCachePrivate();
46 - if ( !$wgUser->isLoggedIn() ) {
 45+ if ( !$wgUser->isLoggedIn() )
4746 $this->dieUsage( 'You must be logged-in to have a watchlist', 'notloggedin' );
4847
4948 $params = $this->extractRequestParams();
Index: branches/REL1_16/phase3/includes/api/ApiQueryRevisions.php
@@ -396,9 +396,6 @@
397397
398398 if ( !is_null( $this->token ) )
399399 {
400 - // Don't cache tokens
401 - $this->getMain()->setCachePrivate();
402 -
403400 $tokenFunctions = $this->getTokenFunctions();
404401 foreach ( $this->token as $t )
405402 {
Index: branches/REL1_16/phase3/includes/api/ApiParse.php
@@ -118,11 +118,10 @@
119119 if ( !$titleObj )
120120 $titleObj = Title::newFromText( "API" );
121121 $wgTitle = $titleObj;
122 - if ( $params['pst'] || $params['onlypst'] ) {
 122+ if ( $params['pst'] || $params['onlypst'] )
123123 $text = $wgParser->preSaveTransform( $text, $titleObj, $wgUser, $popts );
124 - $this->getMain()->setVaryCookie();
125 - }
126 - if ( $params['onlypst'] ) {
 124+ if ( $params['onlypst'] )
 125+ {
127126 // Build a result and bail out
128127 $result_array['text'] = array();
129128 $this->getResult()->setContent( $result_array['text'], $text );
@@ -326,4 +325,4 @@
327326 public function getVersion() {
328327 return __CLASS__ . ': $Id$';
329328 }
330 -}
 329+}
\ No newline at end of file
Index: branches/REL1_16/phase3/includes/api/ApiPurge.php
@@ -42,7 +42,6 @@
4343 */
4444 public function execute() {
4545 global $wgUser;
46 - $this->getMain()->setCachePrivate();
4746 $params = $this->extractRequestParams();
4847 if ( !$wgUser->isAllowed( 'purge' ) )
4948 $this->dieUsageMsg( array( 'cantpurge' ) );
Index: branches/REL1_16/phase3/includes/api/ApiQueryAllmessages.php
@@ -46,9 +46,6 @@
4747 {
4848 global $wgLang;
4949 $wgLang = Language::factory( $params['lang'] );
50 - } else if ( is_null( $params['lang'] ) ) {
51 - // Language not determined by URL but by user preferences, so don't cache
52 - $this->getMain()->setVaryCookie();
5350 }
5451
5552 $prop = array_flip( (array)$params['prop'] );
Index: branches/REL1_16/phase3/includes/api/ApiQueryUserContributions.php
@@ -164,9 +164,7 @@
165165 "rev_timestamp $op= '$encTS')" );
166166 }
167167
168 - // Make sure private data (deleted revisions) isn't cached
169 - $this->getMain()->setVaryCookie();
170 - if ( !$wgUser->isAllowed( 'hideuser' ) ) {
 168+ if ( !$wgUser->isAllowed( 'hideuser' ) )
171169 $this->addWhere( $this->getDB()->bitAnd( 'rev_deleted', Revision::DELETED_USER ) . ' = 0' );
172170 // We only want pages by the specified users.
173171 if ( $this->prefixMode )
@@ -212,12 +210,8 @@
213211 $this->fld_patrolled )
214212 {
215213 global $wgUser;
216 - // Don't cache private data
217 - $this->getMain()->setVaryCookie();
218 - if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() ) {
219 - $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
220 - }
221 -
 214+ if ( !$wgUser->useRCPatrol() && !$wgUser->useNPPatrol() )
 215+ $this->dieUsage( "You need the patrol right to request the patrolled flag", 'permissiondenied' );
222216 // Use a redundant join condition on both
223217 // timestamp and ID so we can use the timestamp
224218 // index
Index: branches/REL1_16/phase3/includes/api/ApiQueryUsers.php
@@ -156,9 +156,6 @@
157157
158158 if ( !is_null( $params['token'] ) )
159159 {
160 - // Don't cache tokens
161 - $this->getMain()->setCachePrivate();
162 -
163160 $tokenFunctions = $this->getTokenFunctions();
164161 foreach ( $params['token'] as $t )
165162 {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r693541.16: MFT r69339mah22:09, 14 July 2010
r69355followup r69354: setVaryCookie() one more timemah22:14, 14 July 2010
r69357re r69350: token was input, not outputmah22:39, 14 July 2010
r69367Trailing bracket typo fixmah00:35, 15 July 2010
r69370MFT r69369mah01:17, 15 July 2010

Comments

#Comment by Catrope (talk | contribs)   07:40, 20 July 2010

So what happens next? Do we ship 1.16 without this fix? Does someone (who?) commit another, non-broken backport?

Status & tagging log