r85997 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85996‎ | r85997 | r85998 >
Date:22:57, 13 April 2011
Author:brion
Status:ok
Tags:
Comment:
Revert r82120: untested code causes fatal error on Special:Contributions when using CentralAuth extension.

The hook is receiving a Title object, then passing it to a function that expects a User object. This naturally fails with a fatal error when User-specific methods are called.
Please don't make commits to CentralAuth without testing them; it's an important component to production sites and it's easy to break it. If it's worth making the change, it's worth setting up a test environment. :)
Modified paths:
  • /trunk/extensions/CentralAuth/CentralAuth.i18n.php (modified) (history)
  • /trunk/extensions/CentralAuth/CentralAuth.php (modified) (history)
  • /trunk/extensions/CentralAuth/CentralAuthHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/CentralAuth.php
@@ -188,9 +188,6 @@
189189 $wgHooks['getUserPermissionsErrorsExpensive'][] = 'CentralAuthHooks::onGetUserPermissionsErrorsExpensive';
190190 $wgHooks['MakeGlobalVariablesScript'][] = 'CentralAuthHooks::onMakeGlobalVariablesScript';
191191
192 -// For Special:Contributions
193 -$wgHooks['ContributionsToolLinks'][] = 'CentralAuthHooks::onContributionsToolLinks';
194 -
195192 // For interaction with the Special:Renameuser extension
196193 $wgHooks['RenameUserWarning'][] = 'CentralAuthHooks::onRenameUserWarning';
197194 $wgHooks['RenameUserPreRename'][] = 'CentralAuthHooks::onRenameUserPreRename';
Index: trunk/extensions/CentralAuth/CentralAuthHooks.php
@@ -612,23 +612,4 @@
613613 $params['url'] = $wiki->getUrl( 'User:' . str_replace( ' ', '_', $user->getName() ) );
614614 return true;
615615 }
616 -
617 - public static function onContributionsToolLinks( $id, $user, &$tools ) {
618 - global $wgUser;
619 -
620 - $globalUser = CentralAuthUser::getInstance( $user );
621 - if ( $globalUser->exists() ) {
622 - if ( $wgUser->isAllowed( 'centralauth-merge' ) ) { // Paranoia. Currently this right is assigned to '*'
623 - $sk = $wgUser->getSkin();
624 - $tools[] = $sk->linkKnown(
625 - SpecialPage::getTitleFor( 'CentralAuth', $user->getText() ),
626 - wfMsg( 'centralauth-link-on-contribs' ),
627 - array( 'title' => wfMsgExt( 'centralauth-link-on-contribs-text', 'parseinline' ) )
628 - );
629 - }
630 - } else {
631 - $tools[] = wfMsg( 'centralauth-link-on-contribs-no' );
632 - }
633 - return true;
634 - }
635616 }
Index: trunk/extensions/CentralAuth/CentralAuth.i18n.php
@@ -238,11 +238,6 @@
239239 Renaming it will cause the local user to be detached from the global one.",
240240 'centralauth-renameuser-reserved' => "User $2 is reserved for a global account.",
241241
242 - // Interaction with Special:Contributions
243 - 'centralauth-link-on-contribs' => 'global account status',
244 - 'centralauth-link-on-contribs-text' => 'Status of the global account for this user',
245 - 'centralauth-link-on-contribs-no' => 'no global account',
246 -
247242 // Other messages
248243 'centralauth-invalid-wiki' => 'No such wiki database: $1',
249244 'centralauth-account-exists' => 'Cannot create account: the requested username is already taken in the unified login system.',

Follow-up revisions

RevisionCommit summaryAuthorDate
r85999Use type hinting on CentralAuthUser::getInstance()'s user parameter. Makes it...brion22:58, 13 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82120Add a link to Special:CentralAuth/username on the Special:Contributions tool ...raymond17:59, 14 February 2011

Status & tagging log