Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/197969
Change subject: Use UserGetReservedNames hook instead of re-inventing its
functionality
......................................................................
Use UserGetReservedNames hook instead of re-inventing its functionality
Change-Id: Ifcfe523314d367677f417dfa2df9bdf87b30d1c3
---
M Babel.php
M BabelAutoCreate.class.php
M i18n/en.json
3 files changed, 5 insertions(+), 14 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Babel
refs/changes/69/197969/1
diff --git a/Babel.php b/Babel.php
index 26aab8d..8095fb4 100644
--- a/Babel.php
+++ b/Babel.php
@@ -30,7 +30,7 @@
);
$GLOBALS['wgHooks']['ParserFirstCallInit'][] =
'BabelStatic::onParserFirstCallInit';
-$GLOBALS['wgHooks']['AbortNewAccount'][] =
'BabelAutoCreate::onAbortNewAccount';
+$GLOBALS['wgHooks']['UserGetReservedNames'][] =
'BabelAutoCreate::onUserGetReservedNames';
$GLOBALS['wgMessagesDirs']['Babel'] = __DIR__ . '/i18n';
$GLOBALS['wgExtensionMessagesFiles']['Babel'] = __DIR__ . '/Babel.i18n.php';
diff --git a/BabelAutoCreate.class.php b/BabelAutoCreate.class.php
index 3cb27d1..3a30c41 100644
--- a/BabelAutoCreate.class.php
+++ b/BabelAutoCreate.class.php
@@ -22,18 +22,10 @@
*/
protected static $user = false;
- /**
- * Abort user creation if the username is that of the autocreation
username.
- * @param $user User
- * @param $errorText
- * @return bool
- */
- public static function onAbortNewAccount( User $user, &$errorText ) {
- $url = wfMessage( 'babel-url' )->text();
- $errorText = wfMessage( 'babel-autocreate-abort', $url
)->parse();
- $autoCreateUser = wfMessage( 'babel-autocreate-user'
)->inContentLanguage()->plain();
+ public static function onUserGetReservedNames( &$names ) {
+ $names[] = 'msg:babel-autocreate-user';
- return $user->getName() !== $autoCreateUser;
+ return true;
}
/**
diff --git a/i18n/en.json b/i18n/en.json
index 7e5a795..a8341de 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -9,7 +9,6 @@
"babel-desc": "Adds the <code>#babel</code> parser function to allow
automated generation of a babel userbox column with the ability to include
custom templates",
"babel-url": "Project:Babel",
"babel-footer-url": ":Category:Babel - Users by language",
- "babel-autocreate-abort": "The username you specified is used for
[[$1|Babel]] category auto-creation and cannot be registered.",
"babel-autocreate-reason": "Automatically creating [[$1|Babel]] category
page.",
"babel-autocreate-text-levels": "Users in this category indicate they have
skill level $1 for language $2.",
"babel-autocreate-text-main": "Users in this category indicate they have
knowledge of language $1.",
@@ -35,4 +34,4 @@
"babel-portal": "",
"babel-template": "Template:User $1",
"babel-footer": "Users by language"
-}
\ No newline at end of file
+}
--
To view, visit https://gerrit.wikimedia.org/r/197969
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifcfe523314d367677f417dfa2df9bdf87b30d1c3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Babel
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits