r56515 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56514‎ | r56515 | r56516 >
Date:14:30, 17 September 2009
Author:werdna
Status:ok (Comments)
Tags:
Comment:
Revert r56450 (encompassing r56447 and r56448) and r56133 on wmf-deployment. They break global userrights because PHP does not have late static binding
Modified paths:
  • /branches/wmf-deployment/extensions/CentralAuth/SpecialGlobalGroupMembership.php (modified) (history)
  • /branches/wmf-deployment/includes/api/ApiQueryUsers.php (modified) (history)
  • /branches/wmf-deployment/includes/api/ApiUserrights.php (modified) (history)
  • /branches/wmf-deployment/includes/specials/SpecialUserrights.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/CentralAuth/SpecialGlobalGroupMembership.php
@@ -72,7 +72,7 @@
7373 }
7474 }
7575
76 - static function fetchUser( $username ) {
 76+ function fetchUser( $username ) {
7777 global $wgUser, $wgRequest;
7878
7979 $knownwiki = $wgRequest->getVal('wpKnownWiki');
Index: branches/wmf-deployment/includes/api/ApiUserrights.php
@@ -45,7 +45,8 @@
4646 if(is_null($params['token']))
4747 $this->dieUsageMsg(array('missingparam', 'token'));
4848
49 - $user = UserrightsPage::fetchUser($params['user']);
 49+ $form = new UserrightsPage;
 50+ $user = $form->fetchUser($params['user']);
5051 if($user instanceof WikiErrorMsg)
5152 $this->dieUsageMsg(array_merge(
5253 (array)$user->getMessageKey(),
Index: branches/wmf-deployment/includes/api/ApiQueryUsers.php
@@ -170,26 +170,9 @@
171171 }
172172 // Second pass: add result data to $retval
173173 foreach($goodNames as $u) {
174 - if(!isset($data[$u])) {
175 - $data[$u] = array('name' => $u);
176 - $iwUser = UserrightsPage::fetchUser($u);
177 - if($iwUser instanceof UserRightsProxy) {
178 - $data[$u]['interwiki'] = '';
179 - if(!is_null($params['token']))
180 - {
181 - $tokenFunctions = $this->getTokenFunctions();
182 - foreach($params['token'] as $t)
183 - {
184 - $val = call_user_func($tokenFunctions[$t], $iwUser);
185 - if($val === false)
186 - $this->setWarning("Action '$t' is not allowed for the current user");
187 - else
188 - $data[$u][$t . 'token'] = $val;
189 - }
190 - }
191 - } else
192 - $data[$u]['missing'] = '';
193 - } else {
 174+ if(!isset($data[$u]))
 175+ $data[$u] = array('name' => $u, 'missing' => '');
 176+ else {
194177 if(isset($this->prop['groups']) && isset($data[$u]['groups']))
195178 $this->getResult()->setIndexedTagName($data[$u]['groups'], 'g');
196179 }
Index: branches/wmf-deployment/includes/specials/SpecialUserrights.php
@@ -144,7 +144,7 @@
145145 function saveUserGroups( $username, $reason = '' ) {
146146 global $wgRequest, $wgUser, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf;
147147
148 - $user = self::fetchUser( $username );
 148+ $user = $this->fetchUser( $username );
149149 if( $user instanceof WikiErrorMsg ) {
150150 $wgOut->addWikiMsgArray( $user->getMessageKey(), $user->getMessageArgs() );
151151 return;
@@ -250,7 +250,7 @@
251251 function editUserGroupsForm( $username ) {
252252 global $wgOut;
253253
254 - $user = self::fetchUser( $username );
 254+ $user = $this->fetchUser( $username );
255255 if( $user instanceof WikiErrorMsg ) {
256256 $wgOut->addWikiMsgArray( $user->getMessageKey(), $user->getMessageArgs() );
257257 return;

Follow-up revisions

RevisionCommit summaryAuthorDate
r56534merge most of r56515 back to trunk (changing UserrightsPage::fetchUser to non...mrzman16:21, 17 September 2009
r56535merge CentralAuth fix from r56515mrzman16:22, 17 September 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r56133API: Make it possible to fetch userrights tokens for interwiki users; make Us...catrope13:44, 10 September 2009
r56447r56133 made fetchUser staticmrzman21:37, 16 September 2009
r56448use fetchUser statically per r56133mrzman21:38, 16 September 2009
r56450Merge r56447 and r56448: fixes needed for CentralAuth derived userrights modu...brion21:50, 16 September 2009

Comments

#Comment by Nikerabbit (talk | contribs)   18:59, 17 September 2009

PHP does not have late static binding

It does in 5.3.0, but there is a long way to go before we can actually use it.

Status & tagging log