diff --git a/CentralAuth.i18n.php b/CentralAuth.i18n.php
index 07dec15..1d63842 100644
--- a/CentralAuth.i18n.php
+++ b/CentralAuth.i18n.php
@@ -219,6 +219,7 @@ The passwords for local accounts created before the merge will revert to their p
'centralauth-globalrename-complete' => 'Global rename queued...',
'action-centralauth-globalrename' => 'globally rename a user',
'centralauth-globalrename-nonexistent' => 'Global account "<nowiki>1ドル</nowiki>" does not exist.',
+ 'centralauth-globalrename-in-progress' => 'There is already a global rename in progress for <nowiki>1ドル</nowiki>.',
// List of global users
'globalusers' => 'Global user list',
@@ -745,6 +746,7 @@ See also:
'centralauth-renameuser-globalrenameuser' => '{{Logentry}}
* 4ドル - the new username',
'right-centralauth-globalrename' => '{{doc-right|centralauth-globalrename}}',
+ 'centralauth-globalrename-in-progress' => 'Error message shown when a global rename is already in progress on this username.',
);
/** Afrikaans (Afrikaans)
diff --git a/specials/SpecialCentralAuth.php b/specials/SpecialCentralAuth.php
index a289f23..91b4354 100644
--- a/specials/SpecialCentralAuth.php
+++ b/specials/SpecialCentralAuth.php
@@ -233,14 +233,19 @@ class SpecialCentralAuth extends SpecialPage {
return true;
}
+ $cdb = CentralAuthUser::getCentralDB();
+ if ( !$cdb->lockIsFree( 'centralauth-globalrename:' . $newName, __METHOD__ ) ) {
+ $this->showError( 'centralauth-globalrename-in-progress', $currentName );
+ return true;
+ }
+ $cdb->lock( "centralauth-globalrename:" . $newName, __METHOD__ );
+
$startedLocked = $globalUser->isLocked();
// Lock the user before we start changing anything.
if ( !$startedLocked ) {
$globalUser->adminLock();
}
- CentralAuthUser::getCentralDB()->lock( "centralauth-globalrename:" . $newName, __METHOD__ );
-
// Update the globaluser and localuser tables. The existing hooks should deal with globalnames/localnames...
$tables = array( 'globaluser' => 'gu', 'localuser' => 'lu' );
foreach ( $tables as $table => $prefix ) {