SHARE
    TWEET
    Krenair

    CA global rename changes #2

    Jan 31st, 2013
    138
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    Diff 3.53 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. // List of global users
    11. 'globalusers' => 'Global user list',
    12. @@ -745,6 +746,7 @@ See also:
    13. 'centralauth-renameuser-globalrenameuser' => '{{Logentry}}
    14. * 4ドル - the new username',
    15. 'right-centralauth-globalrename' => '{{doc-right|centralauth-globalrename}}',
    16. + 'centralauth-globalrename-in-progress' => 'Error message shown when a global rename is already in progress on this username.',
    17. );
    18. /** Afrikaans (Afrikaans)
    19. diff --git a/LocalRenameUserJob.php b/LocalRenameUserJob.php
    20. index 7860654..d1d117d 100644
    21. --- a/LocalRenameUserJob.php
    22. +++ b/LocalRenameUserJob.php
    23. @@ -72,7 +72,9 @@ class CentralAuthLocalRenameUserJob extends Job {
    24. ),
    25. __METHOD__
    26. );
    27. - CentralAuthUser::getCentralDB()->unlock( "centralauth-globalrename:" . $this->params['to'], __METHOD__ );
    28. + $cdb = CentralAuthUser::getCentralDB();
    29. + $cdb->unlock( "centralauth-globalrename:" . $this->params['from'], __METHOD__ );
    30. + $cdb->unlock( "centralauth-globalrename:" . $this->params['to'], __METHOD__ );
    31. } else {
    32. $wgMemc->set( $wikiListKey, $wikiList );
    33. }
    34. diff --git a/specials/SpecialCentralAuth.php b/specials/SpecialCentralAuth.php
    35. index a289f23..c1edb7a 100644
    36. --- a/specials/SpecialCentralAuth.php
    37. +++ b/specials/SpecialCentralAuth.php
    38. @@ -233,14 +233,20 @@ class SpecialCentralAuth extends SpecialPage {
    39. return true;
    40. }
    41. + $cdb = CentralAuthUser::getCentralDB();
    42. + if ( !$cdb->lockIsFree( 'centralauth-globalrename:' . $currentName, __METHOD__ ) ) {
    43. + $this->showError( 'centralauth-globalrename-in-progress', $currentName );
    44. + return true;
    45. + }
    46. + $cdb->lock( "centralauth-globalrename:" . $currentName, __METHOD__ );
    47. + $cdb->lock( "centralauth-globalrename:" . $newName, __METHOD__ );
    48. +
    49. $startedLocked = $globalUser->isLocked();
    50. // Lock the user before we start changing anything.
    51. if ( !$startedLocked ) {
    52. $globalUser->adminLock();
    53. }
    54. - CentralAuthUser::getCentralDB()->lock( "centralauth-globalrename:" . $newName, __METHOD__ );
    55. -
    56. // Update the globaluser and localuser tables. The existing hooks should deal with globalnames/localnames...
    57. $tables = array( 'globaluser' => 'gu', 'localuser' => 'lu' );
    58. foreach ( $tables as $table => $prefix ) {
    Advertisement
    Add Comment
    Please, Sign In to add comment
    Public Pastes
    We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
    Not a member of Pastebin yet?
    Sign Up, it unlocks many cool features!

    AltStyle によって変換されたページ (->オリジナル) /