jenkins-bot has submitted this change and it was merged.
Change subject: Don't localize Special:CentralAutoLogin
......................................................................
Don't localize Special:CentralAutoLogin
Localization of Special:CentralAutoLogin causes problems for log
analysis and for dealing with the large number of hits that can come
into this page (e.g. bug 54195 comment 20). At the same time, it gives
miniscule benefit to users, as it is never exposed in the public user
interface.
So let's just remove the localization of it. To really make it work, we
also need to prevent the redirect from "Special:CentralAutoLogin" to the
localized version of the "Special" namespace.
Bug: 54195
Change-Id: I820370de3afa0bdfce360cba1aef651ac084fd06
---
M CentralAuth.alias.php
A CentralAuth.notranslate-alias.php
M CentralAuth.php
M CentralAuthHooks.php
4 files changed, 40 insertions(+), 3 deletions(-)
Approvals:
CSteipp: Looks good to me, approved
Siebrand: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/CentralAuth.alias.php b/CentralAuth.alias.php
index 7e44dbb..9b5e86b 100644
--- a/CentralAuth.alias.php
+++ b/CentralAuth.alias.php
@@ -1,6 +1,7 @@
<?php
/**
* Aliases for special pages of CentralAuth extension.
+ * See also CentralAuth.notranslate-alias.php
*
* @file
* @ingroup Extensions
@@ -12,7 +13,6 @@
/** English (English) */
$specialPageAliases['en'] = array(
'CentralAuth' => array( 'CentralAuth' ),
- 'CentralAutoLogin' => array( 'CentralAutoLogin' ),
'MergeAccount' => array( 'MergeAccount' ),
'GlobalGroupMembership' => array( 'GlobalUserRights',
'GlobalGroupMembership' ),
'GlobalGroupPermissions' => array( 'GlobalGroupPermissions' ),
diff --git a/CentralAuth.notranslate-alias.php
b/CentralAuth.notranslate-alias.php
new file mode 100644
index 0000000..5ead4a3
--- /dev/null
+++ b/CentralAuth.notranslate-alias.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Aliases for special pages of CentralAuth extension that should not be
+ * translated.
+ *
+ * Do not add this file to translatewiki.
+ *
+ * @file
+ * @ingroup Extensions
+ */
+// @codingStandardsIgnoreFile
+
+$specialPageAliases = array();
+
+/** English (English) */
+$specialPageAliases['en'] = array(
+ // Localizing Special:CentralAutoLogin causes issues (bug 54195) and is
of
+ // miniscule benefit to users, so don't do so.
+ 'CentralAutoLogin' => array( 'CentralAutoLogin' ),
+);
diff --git a/CentralAuth.php b/CentralAuth.php
index 0026379..8f3eca4 100644
--- a/CentralAuth.php
+++ b/CentralAuth.php
@@ -244,6 +244,7 @@
$wgExtensionMessagesFiles['SpecialCentralAuth'] =
"$caBase/CentralAuth.i18n.php";
$wgExtensionMessagesFiles['SpecialCentralAuthAliases'] =
"$caBase/CentralAuth.alias.php";
+$wgExtensionMessagesFiles['SpecialCentralAuthAliasesNoTranslate'] =
"$caBase/CentralAuth.notranslate-alias.php";
$wgJobClasses['crosswikiSuppressUser'] = 'CentralAuthSuppressUserJob';
@@ -279,6 +280,7 @@
$wgHooks['APIGetAllowedParams'][] = 'CentralAuthHooks::onAPIGetAllowedParams';
$wgHooks['APIGetParamDescription'][] =
'CentralAuthHooks::onAPIGetParamDescription';
$wgHooks['ApiCheckCanExecute'][] = 'CentralAuthHooks::onApiCheckCanExecute';
+$wgHooks['TestCanonicalRedirect'][] =
'CentralAuthHooks::onTestCanonicalRedirect';
// For interaction with the Special:Renameuser extension
$wgHooks['RenameUserWarning'][] = 'CentralAuthHooks::onRenameUserWarning';
diff --git a/CentralAuthHooks.php b/CentralAuthHooks.php
index dc7bd1e..7b15f2b 100644
--- a/CentralAuthHooks.php
+++ b/CentralAuthHooks.php
@@ -1070,8 +1070,10 @@
if ( $wgCentralAuthLoginWiki && wfWikiID() !==
$wgCentralAuthLoginWiki ) {
$out->addModules(
'ext.centralauth.centralautologin' );
- // For non-JS clients
- $url = Title::newFromText(
'Special:CentralAutoLogin/start' )->getFullURL( array(
+ // For non-JS clients. Use WikiMap to avoid
localization of the
+ // 'Special' namespace, see bug 54195.
+ $wiki = WikiMap::getWiki( wfWikiID() );
+ $url = wfAppendQuery( $wiki->getFullUrl(
'Special:CentralAutoLogin/start' ), array(
'type' => '1x1',
) );
$out->addHTML( '<noscript>' . Xml::element(
'img',
@@ -1534,4 +1536,17 @@
$id = $centralUser->getId();
return true;
}
+
+ /**
+ * Prevent "canonicalization" of Special:CentralAutoLogin to a localized
+ * Special namespace name. See bug 54195.
+ * @param WebRequest $request
+ * @param Title $title
+ * @param OutputPage $output
+ * @return boolean
+ */
+ public static function onTestCanonicalRedirect( $request, $title,
$output ) {
+ return $title->getNamespace() !== NS_SPECIAL ||
+ strncmp( $request->getVal( 'title', '' ),
'Special:CentralAutoLogin/', 25 ) !== 0;
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/98461
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I820370de3afa0bdfce360cba1aef651ac084fd06
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: CSteipp <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: QChris <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits