SHARE
    TWEET
    Krenair

    CA global rename changes

    Feb 6th, 2013
    130
    0
    Never
    Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
    Diff 4.77 KB | None | 0 0
    1. diff --git a/CentralAuth.i18n.php b/CentralAuth.i18n.php
    2. index 1d63842..5b38d75 100644
    3. --- a/CentralAuth.i18n.php
    4. +++ b/CentralAuth.i18n.php
    5. @@ -220,6 +220,7 @@ The passwords for local accounts created before the merge will revert to their p
    6. 'action-centralauth-globalrename' => 'globally rename a user',
    7. 'centralauth-globalrename-nonexistent' => 'Global account "<nowiki>1ドル</nowiki>" does not exist.',
    8. 'centralauth-globalrename-in-progress' => 'There is already a global rename in progress for <nowiki>1ドル</nowiki>.',
    9. + 'centralauth-globalrename-tempdisallowed' => 'Global account "<nowiki>1ドル</nowiki>" has more than 2ドル edits. Globally renaming such accounts has been temporarily disallowed while the code is experime
    10. // List of global users
    11. 'globalusers' => 'Global user list',
    12. @@ -747,6 +748,7 @@ See also:
    13. * 4ドル - the new username',
    14. 'right-centralauth-globalrename' => '{{doc-right|centralauth-globalrename}}',
    15. 'centralauth-globalrename-in-progress' => 'Error message shown when a global rename is already in progress on this username.',
    16. + 'centralauth-globalrename-tempdisallowed' => 'Error message shown when trying to rename a user with too many edits (default: 5000). This limitation will hopefully go away when we\'re happy with the
    17. );
    18. /** Afrikaans (Afrikaans)
    19. diff --git a/LocalRenameUserJob.php b/LocalRenameUserJob.php
    20. index d1d117d..07fcd12 100644
    21. --- a/LocalRenameUserJob.php
    22. +++ b/LocalRenameUserJob.php
    23. @@ -21,8 +21,8 @@ class CentralAuthLocalRenameUserJob extends Job {
    24. );
    25. if ( $rus->rename() ) {
    26. - // TODO: For renames of more than RENAMEUSER_CONTRIBJOB (default: 5000), this might need to take place in CentralAuthHooks::onRenameUserComplete
    27. - $wikiListKey = CentralAuthUser::memcKey( 'globalrename', sha1( $from ) );
    28. + // TODO: For renames of more than RENAMEUSER_CONTRIBJOB (default: 5000), we might want to do this in CentralAuthHooks::onRenameUserComplete instead
    29. + $wikiListKey = CentralAuthUser::memcKey( 'globalrename', sha1( $to ) );
    30. $wikiList = $wgMemc->get( $wikiListKey ); // TODO: Find a way to completely disable global renaming if memcache isn't available on all wikis. We can't just quit here if we see that
    31. $wikiList = array_diff( $wikiList, array( $wgDBname ) ); // Remove this wiki from the list.
    32. if ( count( $wikiList ) == 0 ) {
    33. diff --git a/specials/SpecialCentralAuth.php b/specials/SpecialCentralAuth.php
    34. index c1edb7a..7fb17ba 100644
    35. --- a/specials/SpecialCentralAuth.php
    36. +++ b/specials/SpecialCentralAuth.php
    37. @@ -25,7 +25,7 @@ class SpecialCentralAuth extends SpecialPage {
    38. $this->mCanOversight = $this->getUser()->isAllowed( 'centralauth-oversight' );
    39. $this->mCanEdit = $this->mCanUnmerge || $this->mCanLock || $this->mCanOversight;
    40. AutoLoader::loadClass( 'SpecialRenameuser' );
    41. - $this->mCanRename = $this->getUser()->isAllowed( 'centralauth-globalrename' ) && class_exists( 'SpecialRenameuser', false );
    42. + $this->mCanRename = $this->getUser()->isAllowed( 'centralauth-globalrename' ) && class_exists( 'RenameuserSQL', false ) && property_exists( 'RenameuserSQL', 'checkIfUserExists' );
    43. $this->getOutput()->addModules( 'ext.centralauth' );
    44. $this->getOutput()->addModuleStyles( 'ext.centralauth.noflash' );
    45. $this->getOutput()->addJsConfigVars( 'wgMergeMethodDescriptions', $this->getMergeMethodDescriptions() );
    46. @@ -217,6 +217,11 @@ class SpecialCentralAuth extends SpecialPage {
    47. return true;
    48. }
    49. + if ( $this->evaluateTotalEditcount() > RENAMEUSER_CONTRIBJOB ) {
    50. + $this->showError( 'centralauth-globalrename-tempdisallowed', $globalUser->getName(), RENAMEUSER_CONTRIBJOB );
    51. + return true;
    52. + }
    53. +
    54. $currentName = $globalUser->getName();
    55. $newName = $this->getRequest()->getText( 'newname' );
    56. @@ -276,7 +281,7 @@ class SpecialCentralAuth extends SpecialPage {
    57. );
    58. global $wgMemc;
    59. - $wgMemc->set( CentralAuthUser::memcKey( 'globalrename', sha1( $currentName ) ), $globalUser->listAttached() );
    60. + $wgMemc->set( CentralAuthUser::memcKey( 'globalrename', sha1( $newName ) ), $globalUser->listAttached() );
    61. // Put the job into the queue on each wiki it needs to run on
    62. foreach ( $globalUser->listAttached() as $wiki ) {
    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 によって変換されたページ (->オリジナル) /