r62540 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62539‎ | r62540 | r62541 >
Date:20:20, 15 February 2010
Author:catrope
Status:reverted
Tags:
Comment:
API: Optimize read rights check in opensearch so $wgUser doesn't get unstubbed if $wgGroupPermissions['*']['read'] is true
Modified paths:
  • /trunk/phase3/includes/api/ApiOpenSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiOpenSearch.php
@@ -42,15 +42,15 @@
4343 }
4444
4545 public function execute() {
46 - global $wgEnableOpenSearchSuggest, $wgSearchSuggestCacheExpiry;
 46+ global $wgEnableOpenSearchSuggest, $wgSearchSuggestCacheExpiry, $wgGroupPermissions, $wgUser;
4747 $params = $this->extractRequestParams();
4848 $search = $params['search'];
4949 $limit = $params['limit'];
5050 $namespaces = $params['namespace'];
5151 $suggest = $params['suggest'];
5252
53 - // MWSuggest or similar hit
54 - if ( $suggest && !$wgEnableOpenSearchSuggest )
 53+ // MWSuggest or similar hit, or hit without read rights
 54+ if ( ( $suggest && !$wgEnableOpenSearchSuggest ) || ( !$wgGroupPermissions['*']['read'] && !$wgUser->isAllowed( 'read' ) ) )
5555 $srchres = array();
5656 else {
5757 // Open search results may be stored for a very long
@@ -108,4 +108,8 @@
109109 public function getVersion() {
110110 return __CLASS__ . ': $Id$';
111111 }
 112+
 113+ public function isReadMode() {
 114+ return false;
 115+ }
112116 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r62543wmf-deployment: MFT r62540catrope20:23, 15 February 2010
r62544API: Redo r62540 for all modules, easier than I first imaginedcatrope20:42, 15 February 2010

Status & tagging log