Krenair

CA global renaming changes

Jan 31st, 2013
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.52 KB | None | 0 0
  1. diff --git a/CentralAuth.i18n.php b/CentralAuth.i18n.php
  2. index 07dec15..1d63842 100644
  3. --- a/CentralAuth.i18n.php
  4. +++ b/CentralAuth.i18n.php
  5. @@ -219,6 +219,7 @@ The passwords for local accounts created before the merge will revert to their p
  6.         'centralauth-globalrename-complete' => 'Global rename queued...',
  7.         'action-centralauth-globalrename' => 'globally rename a user',
  8.         'centralauth-globalrename-nonexistent' => 'Global account "<nowiki>$1</nowiki>" does not exist.',
  9. +       'centralauth-globalrename-in-progress' => 'There is already a global rename in progress for <nowiki>$1</nowiki>.',
  10.  
  11.         // List of global users
  12.         'globalusers'                    => 'Global user list',
  13. @@ -745,6 +746,7 @@ See also:
  14.         'centralauth-renameuser-globalrenameuser' => '{{Logentry}}
  15.  * $4 - the new username',
  16.         'right-centralauth-globalrename' => '{{doc-right|centralauth-globalrename}}',
  17. +       'centralauth-globalrename-in-progress' => 'Error message shown when a global rename is already in progress on this username.',
  18.  );
  19.  
  20.  /** Afrikaans (Afrikaans)
  21. diff --git a/specials/SpecialCentralAuth.php b/specials/SpecialCentralAuth.php
  22. index a289f23..91b4354 100644
  23. --- a/specials/SpecialCentralAuth.php
  24. +++ b/specials/SpecialCentralAuth.php
  25. @@ -233,14 +233,19 @@ class SpecialCentralAuth extends SpecialPage {
  26.                                 return true;
  27.                         }
  28.  
  29. +                       $cdb = CentralAuthUser::getCentralDB();
  30. +                       if ( !$cdb->lockIsFree( 'centralauth-globalrename:' . $newName, __METHOD__ ) ) {
  31. +                               $this->showError( 'centralauth-globalrename-in-progress', $currentName );
  32. +                               return true;
  33. +                       }
  34. +                       $cdb->lock( "centralauth-globalrename:" . $newName, __METHOD__ );
  35. +
  36.                         $startedLocked = $globalUser->isLocked();
  37.                         // Lock the user before we start changing anything.
  38.                         if ( !$startedLocked ) {
  39.                                 $globalUser->adminLock();
  40.                         }
  41.  
  42. -                       CentralAuthUser::getCentralDB()->lock( "centralauth-globalrename:" . $newName, __METHOD__ );
  43. -
  44.                         // Update the globaluser and localuser tables. The existing hooks should deal with globalnames/localnames...
  45.                         $tables = array( 'globaluser' => 'gu', 'localuser' => 'lu' );
  46.                         foreach ( $tables as $table => $prefix ) {
Advertisement
Add Comment
Please, Sign In to add comment