Umherirrender has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/364128 )
Change subject: Break long lines
......................................................................
Break long lines
Change-Id: I4dd48bea826310fda99ac9f7d416a687636c3bda
---
M includes/CentralAuthHooks.php
M includes/CentralAuthPlugin.php
M includes/CentralAuthPrimaryAuthenticationProvider.php
M includes/CentralAuthUser.php
M includes/LocalRenameJob/LocalRenameUserJob.php
M includes/SuppressUserJob.php
M includes/session/CentralAuthSessionProvider.php
M includes/session/CentralAuthTokenSessionProvider.php
M includes/specials/SpecialCentralAuth.php
M includes/specials/SpecialCentralAutoLogin.php
M includes/specials/SpecialGlobalGroupMembership.php
M includes/specials/SpecialGlobalGroupPermissions.php
M includes/specials/SpecialGlobalRenameProgress.php
M includes/specials/SpecialGlobalRenameQueue.php
M includes/specials/SpecialGlobalRenameUser.php
M includes/specials/SpecialGlobalUsers.php
M includes/specials/SpecialMergeAccount.php
M includes/specials/SpecialMultiLock.php
M includes/specials/SpecialWikiSets.php
19 files changed, 540 insertions(+), 223 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth
refs/changes/28/364128/1
diff --git a/includes/CentralAuthHooks.php b/includes/CentralAuthHooks.php
index 60ef39d..b292acd 100644
--- a/includes/CentralAuthHooks.php
+++ b/includes/CentralAuthHooks.php
@@ -54,7 +54,8 @@
$wgHooks['AbortAutoAccount'][] =
'CentralAuthPreAuthManagerHooks::onAbortAutoAccount';
$wgHooks['UserLoginComplete'][] =
'CentralAuthPreAuthManagerHooks::onUserLoginComplete';
$wgHooks['UserLogout'][] =
'CentralAuthPreAuthManagerHooks::onUserLogout';
- $wgHooks['SpecialPage_initList'][] =
'CentralAuthPreAuthManagerHooks::onSpecialPage_initList';
+ $wgHooks['SpecialPage_initList'][] =
+
'CentralAuthPreAuthManagerHooks::onSpecialPage_initList';
if ( $wgCentralAuthCheckSULMigration ) {
// Install hidden special page for renamed users
@@ -106,7 +107,9 @@
$wgAutoloadClasses['CentralAuthAntiSpoofHooks'] =
"$caBase/AntiSpoof/CentralAuthAntiSpoofHooks.php";
- if ( !class_exists( MediaWiki\Auth\AuthManager::class )
|| !empty( $wgDisableAuthManager ) ) {
+ if ( !class_exists( MediaWiki\Auth\AuthManager::class )
||
+ !empty( $wgDisableAuthManager )
+ ) {
$wgHooks['AbortNewAccount'][] =
'CentralAuthAntiSpoofHooks::asAbortNewAccountHook';
}
@@ -158,12 +161,15 @@
* @param string $type Unused
* @param string $action
* @param Title $title
- * @param Skin|null $skin If null, we want to use the wiki content
language, since that will go to the IRC feed.
+ * @param Skin|null $skin If null, we want to use the wiki content
language,
+ * since that will go to the IRC feed.
* @param array $params
* @param bool $filterWikilinks
* @return string
*/
- public static function onHandleWikiSetLogEntry( $type, $action, $title,
$skin, $params, $filterWikilinks = false ) {
+ public static function onHandleWikiSetLogEntry(
+ $type, $action, $title, $skin, $params, $filterWikilinks = false
+ ) {
if ( $skin ) {
$link = Linker::link( $title, htmlspecialchars(
$params[0] ) );
} else {
@@ -181,8 +187,14 @@
$args = [ WikiSet::formatType( $params[1] ),
WikiSet::formatType( $params[2] ) ];
break;
case 'setchange':
- $args = [ $params[1]
- ? $params[1] : wfMessage( 'rightsnone'
)->text(), $params[2] ? $params[2] : wfMessage( 'rightsnone' )->text() ];
+ $args = [
+ $params[1]
+ ? $params[1]
+ : wfMessage( 'rightsnone'
)->text(),
+ $params[2]
+ ? $params[2]
+ : wfMessage( 'rightsnone'
)->text()
+ ];
break;
default: // 'deleteset'
$args = [];
@@ -206,23 +218,33 @@
* @param string $type Unused
* @param string $action Unused
* @param Title $title Unused
- * @param Skin|null $skin If null, we want to use the wiki content
language, since that will go to the IRC feed.
+ * @param Skin|null $skin If null, we want to use the wiki content
language, since that will
+ * go to the IRC feed.
* @param array $params
* @param bool $filterWikilinks Unused
*
* @return string
*/
- public static function onHandleGrouprenameLogEntry( $type, $action,
$title, $skin, $params, $filterWikilinks = false ) {
+ public static function onHandleGrouprenameLogEntry(
+ $type, $action, $title, $skin, $params, $filterWikilinks = false
+ ) {
// $params[0] is the new one, $params[1] the old one
if ( $skin ) {
- $params[0] = Linker::link( Title::newFromText(
$params[0] ), htmlspecialchars( $params[0] ) );
- $params[1] = Linker::link( Title::newFromText(
$params[1] ), htmlspecialchars( $params[1] ) );
+ $params[0] = Linker::link(
+ Title::newFromText( $params[0] ),
+ htmlspecialchars( $params[0] )
+ );
+ $params[1] = Linker::link(
+ Title::newFromText( $params[1] ),
+ htmlspecialchars( $params[1] )
+ );
} else {
$params[0] = htmlspecialchars( $params[0] );
$params[1] = htmlspecialchars( $params[1] );
}
- $msg = wfMessage( 'centralauth-rightslog-entry-grouprename'
)->rawParams( $params[0], $params[1] );
+ $msg = wfMessage( 'centralauth-rightslog-entry-grouprename' )
+ ->rawParams( $params[0], $params[1] );
if ( $skin ) {
return $msg->text();
} else {
@@ -300,9 +322,11 @@
$attached = count( $global->listAttached() );
$message = wfMessage(
'centralauth-prefs-unattached' )->parse() .
'<br />' .
- wfMessage(
'centralauth-prefs-count-attached' )->numParams( $attached )->parse() .
+ wfMessage(
'centralauth-prefs-count-attached' )
+ ->numParams( $attached
)->parse() .
'<br />' .
- wfMessage(
'centralauth-prefs-count-unattached' )->numParams( $unattached )->parse();
+ wfMessage(
'centralauth-prefs-count-unattached' )
+ ->numParams( $unattached
)->parse();
} elseif ( !$global->isAttached() ) {
// Global account exists but the local account
is not attached
$message = wfMessage(
'centralauth-prefs-detail-unattached' )->parse();
@@ -317,8 +341,10 @@
$manageLinks[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'MergeAccount' ),
wfMessage( 'centralauth-prefs-manage'
)->parse() );
}
- $manageLinks[] = Linker::linkKnown( SpecialPage::getTitleFor(
'CentralAuth', $user->getName() ),
- wfMessage( 'centralauth-prefs-view' )->parse() );
+ $manageLinks[] = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'CentralAuth',
$user->getName() ),
+ wfMessage( 'centralauth-prefs-view' )->parse()
+ );
$manageLinkList = $wgLang->pipeList( $manageLinks );
$preferences['globalaccountstatus'] = [
@@ -329,7 +355,8 @@
'default' => $manageLinkList
];
if ( isset( $message ) ) {
- $manageLinkList = wfMessage( 'parentheses',
$manageLinkList )->text(); // looks weird otherwise
+ // looks weird otherwise
+ $manageLinkList = wfMessage( 'parentheses',
$manageLinkList )->text();
$preferences['globalaccountstatus']['default'] =
"$message<br />$manageLinkList";
}
@@ -400,7 +427,8 @@
$inject_html = wfMessage( 'centralauth-login-no-others'
)->escaped();
} else {
$inject_html = '<div class="centralauth-login-box"><p>'
.
- wfMessage( 'centralauth-login-progress',
$user->getName() )->escaped() . "</p>\n<p>";
+ wfMessage( 'centralauth-login-progress',
+ $user->getName() )->escaped() .
"</p>\n<p>";
foreach ( $wgCentralAuthAutoLoginWikis as $alt =>
$wikiID ) {
$wiki = WikiMap::getWiki( $wikiID );
// Use WikiReference::getFullUrl(), returns a
protocol-relative URL if needed
@@ -474,7 +502,9 @@
// Check that this is actually for a special login page view
$title = $context->getTitle();
- if ( $direct && $title && ( $title->isSpecial( 'Userlogin' ) ||
$title->isSpecial( 'CreateAccount' ) ) ) {
+ if ( $direct && $title && ( $title->isSpecial( 'Userlogin' ) ||
+ $title->isSpecial( 'CreateAccount' ) )
+ ) {
// User will be redirected to
Special:CentralLogin/start (central wiki),
// then redirected back to
Special:CentralLogin/complete (this wiki).
// Sanity check that "returnto" is not one of the
central login pages. If it
@@ -496,12 +526,14 @@
if ( $request->getBool( 'wpForceHttps', false )
||
$request->getSession()->shouldForceHTTPS() ||
- ( $user->getBoolOption( 'prefershttps'
) && wfCanIPUseHTTPS( $request->getIP() ) )
+ ( $user->getBoolOption( 'prefershttps'
) &&
+ wfCanIPUseHTTPS( $request->getIP() ) )
) {
$finalProto = 'https';
}
- $secureCookies = ( ( $finalProto === 'https' )
&& $user->getBoolOption( 'prefershttps' ) );
+ $secureCookies = ( ( $finalProto === 'https' )
&&
+ $user->getBoolOption( 'prefershttps' )
);
}
if ( $wgDisableAuthManager ) {
@@ -525,7 +557,8 @@
'remember' => $remember,
'returnTo' => $returnTo,
'returnToQuery' => $returnToQuery,
- 'stickHTTPS' => $secureCookies, // cookies
set secure or not (local CentralAuth cookies)
+ // cookies set secure or not (local CentralAuth
cookies)
+ 'stickHTTPS' => $secureCookies,
'finalProto' => $finalProto, // final page
http or https
'type' => $type,
] );
@@ -540,7 +573,8 @@
'wikiId' => wfWikiId(),
'secureCookies' => $secureCookies, // (bool)
cookies secure or not
'finalProto' => $finalProto, // http or
https for very final page
- 'currentProto' => $request->detectProtocol()
// current proto (in case login is https, but final page is http)
+ // current proto (in case login is https, but
final page is http)
+ 'currentProto' => $request->detectProtocol()
];
Hooks::run( 'CentralAuthLoginRedirectData', [
$centralUser, &$data ] );
CentralAuthUtils::getSessionCache()->set( $key, $data,
60 );
@@ -613,13 +647,16 @@
$inject_html = wfMessage(
'centralauth-logout-no-others' )->escaped();
} else {
$inject_html = '<div
class="centralauth-logout-box"><p>' .
- wfMessage( 'centralauth-logout-progress',
$user->getName() )->escaped() . "</p>\n<p>";
+ wfMessage( 'centralauth-logout-progress',
$user->getName() )->escaped() .
+ "</p>\n<p>";
foreach ( $wikis as $alt => $wikiID ) {
$wiki = WikiMap::getWiki( $wikiID );
// Use WikiReference::getFullUrl(), returns a
protocol-relative URL if needed
- $url = wfAppendQuery( $wiki->getFullUrl(
'Special:CentralAutoLogin/deleteCookies' ), [
- 'type' => 'icon',
- ] );
+ $url = wfAppendQuery(
+ $wiki->getFullUrl(
'Special:CentralAutoLogin/deleteCookies' ), [
+ 'type' => 'icon',
+ ]
+ );
$inject_html .= Xml::element( 'img',
[
'src' => $url,
@@ -672,7 +709,9 @@
if ( $newCentral->renameInProgress() ) {
$warnings[] = [
'centralauth-renameuser-global-inprogress', $newName ];
// Can potentially be renaming two accounts into the
same name, so throw an error
- throw new ErrorPageError( 'error',
'centralauth-renameuser-global-inprogress', [ $newName ] );
+ throw new ErrorPageError(
+ 'error',
'centralauth-renameuser-global-inprogress', [ $newName ]
+ );
}
return true;
@@ -990,8 +1029,9 @@
}
if (
$centralUser->isOversighted() || // Oversighted
users should *never* be able to edit
- ( $centralUser->isLocked() && !in_array(
$title->getPrefixedText(), $wgCentralAuthLockedCanEdit ) )
- ) {
+ ( $centralUser->isLocked() &&
+ !in_array( $title->getPrefixedText(),
$wgCentralAuthLockedCanEdit ) )
+ ) {
$result = 'centralauth-error-locked';
return false;
}
@@ -1171,7 +1211,9 @@
$params['domain'] = $parts[2];
}
$params['properties']['ca-local-url'] = $params['url'];
- $params['url'] = $wiki->getUrl( MWNamespace::getCanonicalName(
NS_USER ) . ':' . $user->getTitleKey() );
+ $params['url'] = $wiki->getUrl(
+ MWNamespace::getCanonicalName( NS_USER ) . ':' .
$user->getTitleKey()
+ );
return true;
}
@@ -1316,7 +1358,9 @@
* @param string[] &$qc
* @return bool
*/
- public static function onSpecialLogAddLogSearchRelations( $type,
WebRequest $request, array &$qc ) {
+ public static function onSpecialLogAddLogSearchRelations(
+ $type, WebRequest $request, array &$qc
+ ) {
if ( $type === 'gblrename' ) {
$oldname = trim( $request->getText( 'oldname' ) );
$canonicalOldname = User::getCanonicalName( $oldname );
@@ -1350,12 +1394,16 @@
}
}
- public static function onResourceLoaderForeignApiModules( array
&$dependencies, ResourceLoaderContext $context = null ) {
+ public static function onResourceLoaderForeignApiModules(
+ array &$dependencies, ResourceLoaderContext $context = null
+ ) {
$dependencies[] = 'ext.centralauth.ForeignApi';
return true;
}
- public static function onResourceLoaderTestModules( array
&$testModules, ResourceLoader &$resourceLoader ) {
+ public static function onResourceLoaderTestModules(
+ array &$testModules, ResourceLoader &$resourceLoader
+ ) {
$testModules['qunit']['ext.centralauth.ForeignApi.test'] = [
'scripts' => [
'tests/qunit/ext.centralauth.ForeignApi.test.js' ],
'dependencies' => [ 'ext.centralauth.ForeignApi' ],
diff --git a/includes/CentralAuthPlugin.php b/includes/CentralAuthPlugin.php
index 43c5fad..1ed0ead 100644
--- a/includes/CentralAuthPlugin.php
+++ b/includes/CentralAuthPlugin.php
@@ -57,13 +57,16 @@
if ( !$passwordMatch && $wgCentralAuthCheckSULMigration ) {
// Check to see if this is a user who was affected by a
global username
// collision during a forced migration to central auth
accounts.
- $renamedUsername = User::getCanonicalName( $username .
'~' . str_replace( '_', '-', wfWikiID() ) );
+ $renamedUsername = User::getCanonicalName(
+ $username . '~' . str_replace( '_', '-',
wfWikiID() )
+ );
if ( $renamedUsername !== false ) {
$renamed =
CentralAuthUser::getMasterInstanceByName( $renamedUsername );
if ( $renamed->getId() ) {
wfDebugLog( 'CentralAuth',
- "CentralAuthMigration: Checking
for migration of '{$username}' to '{$renamedUsername}'"
+ "CentralAuthMigration: Checking
for migration of '{$username}' to " .
+ "'{$renamedUsername}'"
);
MediaWikiServices::getInstance()->getStatsdDataFactory()->increment(
'centralauth.migration.check'
@@ -98,10 +101,17 @@
// See if all the unattached accounts match passwords
// and can be globalized. (bug 70392)
if ( $wgCentralAuthAutoMigrateNonGlobalAccounts ) {
- $ok = $central->storeAndMigrate( [ $password ],
/* $sendToRC = */ true, /* $safe = */ true, /* $checkHome = */ true );
+ $ok = $central->storeAndMigrate(
+ [ $password ],
+ /* $sendToRC = */ true,
+ /* $safe = */ true,
+ /* $checkHome = */ true
+ );
if ( $ok ) {
wfDebugLog( 'CentralAuth',
-
"wgCentralAuthAutoMigrateNonGlobalAccounts successful in creating a global
account for '$username'" );
+
"wgCentralAuthAutoMigrateNonGlobalAccounts successful in creating a " .
+ "global account for '$username'"
+ );
return true;
}
}
@@ -350,8 +360,9 @@
// Log the autocreation just happened
$user->addNewUserLogEntryAutoCreate();
} else {
- wfDebugLog( 'CentralAuth-Bug39996', __METHOD__
. ": CentralAuthUser::exists returned false for "
- . "\"{$user->getName()}\" even though
\$autocreate = true." );
+ wfDebugLog( 'CentralAuth-Bug39996', __METHOD__ .
+ ": CentralAuthUser::exists returned
false for " .
+ "\"{$user->getName()}\" even though
\$autocreate = true." );
}
}
}
diff --git a/includes/CentralAuthPrimaryAuthenticationProvider.php
b/includes/CentralAuthPrimaryAuthenticationProvider.php
index 2cf2a51..9d96793 100644
--- a/includes/CentralAuthPrimaryAuthenticationProvider.php
+++ b/includes/CentralAuthPrimaryAuthenticationProvider.php
@@ -102,7 +102,9 @@
}
public function beginPrimaryAuthentication( array $reqs ) {
- $req = AuthenticationRequest::getRequestByClass( $reqs,
PasswordAuthenticationRequest::class );
+ $req = AuthenticationRequest::getRequestByClass(
+ $reqs, PasswordAuthenticationRequest::class
+ );
if ( !$req ) {
return AuthenticationResponse::newAbstain();
}
@@ -159,11 +161,14 @@
return
AuthenticationResponse::newPass( $renamedUsername );
}
$this->manager->setAuthenticationSessionData( 'CA-renamed-from', $username );
-
$this->manager->setAuthenticationSessionData( 'CA-renamed-to', $renamedUsername
);
+
$this->manager->setAuthenticationSessionData(
+ 'CA-renamed-to',
$renamedUsername
+ );
return
AuthenticationResponse::newUI(
[
new
ButtonAuthenticationRequest(
-
'caRenameOk', wfMessage( 'ok' ), wfMessage(
'sulrenamewarning-authmanager-ok-help' )
+
'caRenameOk', wfMessage( 'ok' ),
+
wfMessage( 'sulrenamewarning-authmanager-ok-help' )
)
],
wfMessage(
'sulrenamewarning-renamed', $username, $renamedUsername ),
@@ -252,7 +257,9 @@
if ( $username === null || $renamedUsername === null ) {
// What?
$this->logger->debug( 'Missing "CA-renamed-from" or
"CA-renamed-to" in session data' );
- return AuthenticationResponse::newFail( wfMessage(
'authmanager-authn-not-in-progress' ) );
+ return AuthenticationResponse::newFail(
+ wfMessage( 'authmanager-authn-not-in-progress' )
+ );
}
$req = ButtonAuthenticationRequest::getRequestByName( $reqs,
'caRenameOk' );
@@ -263,7 +270,8 @@
return AuthenticationResponse::newUI(
[
new ButtonAuthenticationRequest(
- 'caRenameOk', wfMessage( 'ok'
), wfMessage( 'sulrenamewarning-authmanager-ok-help' )
+ 'caRenameOk', wfMessage( 'ok' ),
+ wfMessage(
'sulrenamewarning-authmanager-ok-help' )
)
],
wfMessage( 'sulrenamewarning-renamed',
$username, $renamedUsername ),
@@ -337,7 +345,8 @@
if ( $username !== false ) {
$centralUser =
CentralAuthUser::getInstanceByName( $username );
if ( $centralUser->exists() &&
- ( $centralUser->isAttached() ||
!User::idFromName( $username, User::READ_LATEST ) )
+ ( $centralUser->isAttached() ||
+ !User::idFromName( $username,
User::READ_LATEST ) )
) {
$sv = StatusValue::newGood();
if ( $req->password !== null ) {
@@ -356,7 +365,9 @@
}
public function providerChangeAuthenticationData( AuthenticationRequest
$req ) {
- $username = $req->username !== null ? User::getCanonicalName(
$req->username, 'usable' ) : false;
+ $username = $req->username !== null
+ ? User::getCanonicalName( $req->username, 'usable' )
+ : false;
if ( $username === false ) {
return;
}
@@ -397,7 +408,9 @@
if ( $autocreate !== $this->getUniqueId() ) {
// Prevent creation if the user exists centrally
- if ( $centralUser->exists() && $autocreate !==
AuthManager::AUTOCREATE_SOURCE_SESSION ) {
+ if ( $centralUser->exists() &&
+ $autocreate !==
AuthManager::AUTOCREATE_SOURCE_SESSION
+ ) {
$status->fatal( 'centralauth-account-exists' );
return $status;
}
@@ -432,7 +445,9 @@
}
public function testForAccountCreation( $user, $creator, array $reqs ) {
- $req = AuthenticationRequest::getRequestByClass( $reqs,
PasswordAuthenticationRequest::class );
+ $req = AuthenticationRequest::getRequestByClass(
+ $reqs, PasswordAuthenticationRequest::class
+ );
$ret = StatusValue::newGood();
if ( $req && $req->username !== null && $req->password !== null
) {
@@ -447,9 +462,12 @@
// Check CentralAuthAntiSpoof, if applicable
if ( class_exists( 'AntiSpoofAuthenticationRequest' ) ) {
- $antiSpoofReq =
AuthenticationRequest::getRequestByClass( $reqs,
AntiSpoofAuthenticationRequest::class );
+ $antiSpoofReq =
AuthenticationRequest::getRequestByClass(
+ $reqs, AntiSpoofAuthenticationRequest::class
+ );
$ret->merge( CentralAuthAntiSpoofHooks::testNewAccount(
- $user, $creator, $this->antiSpoofAccounts,
$antiSpoofReq && $antiSpoofReq->ignoreAntiSpoof
+ $user, $creator, $this->antiSpoofAccounts,
+ $antiSpoofReq && $antiSpoofReq->ignoreAntiSpoof
) );
}
@@ -457,12 +475,16 @@
}
public function beginPrimaryAccountCreation( $user, $creator, array
$reqs ) {
- $req = AuthenticationRequest::getRequestByClass( $reqs,
PasswordAuthenticationRequest::class );
+ $req = AuthenticationRequest::getRequestByClass(
+ $reqs, PasswordAuthenticationRequest::class
+ );
if ( $req ) {
if ( $req->username !== null && $req->password !== null
) {
$centralUser =
CentralAuthUser::getMasterInstance( $user );
if ( $centralUser->exists() ) {
- return AuthenticationResponse::newFail(
wfMessage( 'centralauth-account-exists' ) );
+ return AuthenticationResponse::newFail(
+ wfMessage(
'centralauth-account-exists' )
+ );
}
if ( $centralUser->listUnattached() ) {
// $this->testUserForCreation() will
already have rejected it if necessary
@@ -485,8 +507,8 @@
DeferredUpdates::addCallableUpdate( function () use (
$centralUser ) {
$centralUser->lazyImportLocalNames();
} );
- // Do the attach in finishAccountCreation instead of begin
because now the user has been added
- // to database and local ID exists (which is needed in attach)
+ // Do the attach in finishAccountCreation instead of begin
because now the user has been
+ // added to database and local ID exists (which is needed in
attach)
$centralUser->attach( wfWikiID(), 'new' );
CentralAuthUtils::getCentralDB()->onTransactionIdle( function
() use ( $centralUser ) {
CentralAuthUtils::scheduleCreationJobs( $centralUser );
diff --git a/includes/CentralAuthUser.php b/includes/CentralAuthUser.php
index 70528b9..a09380b 100644
--- a/includes/CentralAuthUser.php
+++ b/includes/CentralAuthUser.php
@@ -204,7 +204,8 @@
*/
private function checkWriteMode() {
if ( !$this->mFromMaster ) {
- wfDebugLog( 'CentralAuth', "Setter called on a slave
instance: " . wfGetAllCallers( 10 ) );
+ wfDebugLog( 'CentralAuth',
+ "Setter called on a slave instance: " .
wfGetAllCallers( 10 ) );
}
}
@@ -547,7 +548,8 @@
* Return the local user account ID of the user with the same name on
given wiki,
* irrespective of whether it is attached or not
* @param string $wikiId ID for the local database to connect to
- * @return int|null Local user ID for given $wikiID. Null if $wikiID is
invalid or local user doesn't exist
+ * @return int|null Local user ID for given $wikiID. Null if $wikiID is
invalid or local user
+ * doesn't exist
*/
public function getLocalId( $wikiId ) {
// Make sure the wiki ID is valid. (This prevents
DBConnectionError in unit tests)
@@ -869,7 +871,9 @@
* @param bool $checkHome Re-check the user's ownership of the home wiki
* @return bool
*/
- public function storeAndMigrate( $passwords = [], $sendToRC = true,
$safe = false, $checkHome = false ) {
+ public function storeAndMigrate(
+ $passwords = [], $sendToRC = true, $safe = false, $checkHome =
false
+ ) {
$ret = $this->attemptAutoMigration( $passwords, $sendToRC,
$safe, $checkHome );
if ( $ret === true ) {
$this->recordAntiSpoof();
@@ -949,9 +953,13 @@
} elseif ( $count === $maxEdits ) {
// Tie, check earlier registration
// Note that registration might be "null",
which means they're a super old account.
- if ( $migrationSet[$wiki]['registration'] <
$migrationSet[$homeWiki]['registration'] ) {
+ if ( $migrationSet[$wiki]['registration'] <
+ $migrationSet[$homeWiki]['registration']
+ ) {
$homeWiki = $wiki;
- } elseif ( $migrationSet[$wiki]['registration']
=== $migrationSet[$homeWiki]['registration'] ) {
+ } elseif ( $migrationSet[$wiki]['registration']
===
+ $migrationSet[$homeWiki]['registration']
+ ) {
// Another tie? Screw it, pick one
randomly.
$wikis = [ $wiki, $homeWiki ];
$homeWiki = $wikis[mt_rand( 0, 1 )];
@@ -988,7 +996,9 @@
// also assume their email addresses are useful for this
purpose...
if ( $passwords ) {
foreach ( $migrationSet as $wiki => $local ) {
- if ( $local['email'] &&
$local['emailAuthenticated'] && !isset( $passingMail[$local['email']] ) ) {
+ if ( $local['email'] &&
$local['emailAuthenticated'] &&
+ !isset( $passingMail[$local['email']] )
+ ) {
// Test passwords only once here as
comparing hashes is very expensive
$passwordConfirmed[$wiki] =
$this->matchHashes(
$passwords,
@@ -1017,7 +1027,10 @@
} elseif (
isset( $passwordConfirmed[$wiki] ) &&
$passwordConfirmed[$wiki] ||
!isset( $passwordConfirmed[$wiki] ) &&
- $this->matchHashes( $passwords,
$this->getPasswordFromString( $local['password'], $local['id'] ) )
+ $this->matchHashes(
+ $passwords,
+ $this->getPasswordFromString(
$local['password'], $local['id'] )
+ )
) {
// Matches the pre-authenticated password, yay!
$method = 'password';
@@ -1167,7 +1180,9 @@
* @param $checkHome bool Re-check the user's ownership of the home wiki
* @return bool Whether full automatic migration completed successfully.
*/
- protected function attemptAutoMigration( $passwords = [], $sendToRC =
true, $safe = false, $checkHome = false ) {
+ protected function attemptAutoMigration(
+ $passwords = [], $sendToRC = true, $safe = false, $checkHome =
false
+ ) {
$this->checkWriteMode();
$migrationSet = $this->queryUnattached();
if ( empty( $migrationSet ) ) {
@@ -1282,7 +1297,9 @@
// Look for accounts we can match by password
foreach ( $rows as $row ) {
$wiki = $row['wiki'];
- if ( $this->matchHash( $password,
$this->getPasswordFromString( $row['password'], $row['id'] ) )->isGood() ) {
+ if ( $this->matchHash( $password,
+ $this->getPasswordFromString( $row['password'],
$row['id'] ) )->isGood()
+ ) {
wfDebugLog( 'CentralAuth',
"Attaching '$this->mName' on $wiki by
password" );
$this->attach( $wiki, 'password' );
@@ -1387,7 +1404,12 @@
], [ 'user_name' => $this->mName ], __METHOD__
);
- $id = $dblw->selectField( 'user', 'user_id', [
'user_name' => $this->mName ], __METHOD__ );
+ $id = $dblw->selectField(
+ 'user',
+ 'user_id',
+ [ 'user_name' => $this->mName ],
+ __METHOD__
+ );
$this->clearLocalUserCache( $wikiName, $id );
$lb->reuseConnection( $dblw );
@@ -1573,7 +1595,10 @@
if ( !$context->getUser()->isAllowed(
'centralauth-oversight' ) ) {
return Status::newFatal(
'centralauth-admin-not-authorized' );
} elseif ( $this->getGlobalEditCount() >
self::HIDE_CONTRIBLIMIT ) {
- return Status::newFatal( $context->msg(
'centralauth-admin-too-many-edits', $this->mName )->numParams(
self::HIDE_CONTRIBLIMIT ) );
+ return Status::newFatal(
+ $context->msg(
'centralauth-admin-too-many-edits', $this->mName )
+ ->numParams(
self::HIDE_CONTRIBLIMIT )
+ );
}
}
@@ -1591,10 +1616,12 @@
if ( !$isLocked && $setLocked ) {
$lockStatus = $this->adminLock();
- $added[] = $context->msg(
'centralauth-log-status-locked' )->inContentLanguage()->text();
+ $added[] =
+ $context->msg( 'centralauth-log-status-locked'
)->inContentLanguage()->text();
} elseif ( $isLocked && !$setLocked ) {
$lockStatus = $this->adminUnlock();
- $removed[] = $context->msg(
'centralauth-log-status-locked' )->inContentLanguage()->text();
+ $removed[] =
+ $context->msg( 'centralauth-log-status-locked'
)->inContentLanguage()->text();
}
if ( $oldHiddenLevel != $setHidden ) {
@@ -1602,21 +1629,27 @@
switch ( $setHidden ) {
case self::HIDDEN_NONE:
if ( $oldHiddenLevel ==
self::HIDDEN_OVERSIGHT ) {
- $removed[] = $context->msg(
'centralauth-log-status-oversighted' )->inContentLanguage()->text();
+ $removed[] = $context->msg(
'centralauth-log-status-oversighted' )
+
->inContentLanguage()->text();
} else {
- $removed[] = $context->msg(
'centralauth-log-status-hidden' )->inContentLanguage()->text();
+ $removed[] = $context->msg(
'centralauth-log-status-hidden' )
+
->inContentLanguage()->text();
}
break;
case self::HIDDEN_LISTS:
- $added[] = $context->msg(
'centralauth-log-status-hidden' )->inContentLanguage()->text();
+ $added[] = $context->msg(
'centralauth-log-status-hidden' )
+ ->inContentLanguage()->text();
if ( $oldHiddenLevel ==
self::HIDDEN_OVERSIGHT ) {
- $removed[] = $context->msg(
'centralauth-log-status-oversighted' )->inContentLanguage()->text();
+ $removed[] = $context->msg(
'centralauth-log-status-oversighted' )
+
->inContentLanguage()->text();
}
break;
case self::HIDDEN_OVERSIGHT:
- $added[] = $context->msg(
'centralauth-log-status-oversighted' )->inContentLanguage()->text();
+ $added[] = $context->msg(
'centralauth-log-status-oversighted' )
+ ->inContentLanguage()->text();
if ( $oldHiddenLevel ==
self::HIDDEN_LISTS ) {
- $removed[] = $context->msg(
'centralauth-log-status-hidden' )->inContentLanguage()->text();
+ $removed[] = $context->msg(
'centralauth-log-status-hidden' )
+
->inContentLanguage()->text();
}
break;
}
@@ -1635,9 +1668,11 @@
// Setup Status object to return all of the information for
logging
if ( $good && ( count( $added ) || count( $removed ) ) ) {
$added = count( $added ) ?
- implode( ', ', $added ) : $context->msg(
'centralauth-log-status-none' )->inContentLanguage()->text();
+ implode( ', ', $added ) : $context->msg(
'centralauth-log-status-none' )
+ ->inContentLanguage()->text();
$removed = count( $removed ) ?
- implode( ', ', $removed ) : $context->msg(
'centralauth-log-status-none' )->inContentLanguage()->text();
+ implode( ', ', $removed ) : $context->msg(
'centralauth-log-status-none' )
+ ->inContentLanguage()->text();
$returnStatus->successCount = count( $added ) + count(
$removed );
$returnStatus->success['added'] = $added;
@@ -2179,7 +2214,9 @@
return;
}
- wfDebugLog( 'CentralAuthVerbose', "Loading attached wiki list
for global user {$this->mName} from DB" );
+ wfDebugLog( 'CentralAuthVerbose',
+ "Loading attached wiki list for global user
{$this->mName} from DB"
+ );
$db = $this->getSafeReadDB();
@@ -2354,7 +2391,8 @@
}
/**
- * Find any remaining migration records for this username which haven't
gotten attached to some global account.
+ * Find any remaining migration records for this username which haven't
gotten attached to
+ * some global account.
* Formatted as associative array with some data.
*
* @throws Exception
@@ -2466,7 +2504,8 @@
$data['block-anononly'] =
(bool)$row->ipb_anon_only;
$data['block-nocreate'] =
(bool)$row->ipb_create_account;
$data['block-noautoblock'] = !(
(bool)$row->ipb_enable_autoblock );
- $data['block-nousertalk'] = !(
(bool)$row->ipb_allow_usertalk ); // Poorly named database column
+ // Poorly named database column
+ $data['block-nousertalk'] = !(
(bool)$row->ipb_allow_usertalk );
$data['block-noemail'] =
(bool)$row->ipb_block_email;
$data['blocked'] = true;
}
@@ -2664,7 +2703,8 @@
'gu_locked' => $this->mLocked,
'gu_hidden' => $this->getHiddenLevel(),
'gu_email' => $this->mEmail,
- 'gu_email_authenticated' =>
$dbw->timestampOrNull( $this->mAuthenticationTimestamp ),
+ 'gu_email_authenticated' =>
+ $dbw->timestampOrNull(
$this->mAuthenticationTimestamp ),
'gu_home_db' => $this->getHomeWiki(),
'gu_cas_token' => $newCasToken
],
@@ -2846,7 +2886,8 @@
// Reload the state
$this->loadStateNoCache();
} else {
- wfDebugLog( 'CentralAuthVerbose', "Deferring cache
invalidation because we're in a transaction" );
+ wfDebugLog( 'CentralAuthVerbose',
+ "Deferring cache invalidation because we're in
a transaction" );
}
}
@@ -2869,7 +2910,8 @@
* Intended to be used for things like migration.
*/
public function endTransaction() {
- wfDebugLog( 'CentralAuthVerbose', "Finishing CentralAuthUser
cache-invalidating transaction" );
+ wfDebugLog( 'CentralAuthVerbose',
+ "Finishing CentralAuthUser cache-invalidating
transaction" );
$this->mDelayInvalidation = false;
$this->invalidateCache();
}
@@ -2881,7 +2923,8 @@
* Intended to be used for things like migration.
*/
public function startTransaction() {
- wfDebugLog( 'CentralAuthVerbose', "Beginning CentralAuthUser
cache-invalidating transaction" );
+ wfDebugLog( 'CentralAuthVerbose',
+ "Beginning CentralAuthUser cache-invalidating
transaction" );
// Delay cache invalidation
$this->mDelayInvalidation = 1;
}
@@ -2906,7 +2949,8 @@
*/
public function getStateHash( $recache = false ) {
$this->loadState( $recache );
- return md5( $this->mGlobalId . ':' . $this->mName . ':' .
$this->mHidden . ':' . (int)$this->mLocked );
+ return md5( $this->mGlobalId . ':' . $this->mName . ':' .
$this->mHidden . ':' .
+ (int)$this->mLocked );
}
/**
diff --git a/includes/LocalRenameJob/LocalRenameUserJob.php
b/includes/LocalRenameJob/LocalRenameUserJob.php
index cc58a5f..0aaf34f 100644
--- a/includes/LocalRenameJob/LocalRenameUserJob.php
+++ b/includes/LocalRenameJob/LocalRenameUserJob.php
@@ -115,10 +115,12 @@
if ( !$status->isOK() ) {
if ( $status->hasMessage( 'promote-not-on-wiki' ) ) {
// Eh, what?
- throw new Exception( "Tried to promote
'$newName' to a global account except it doesn't exist locally" );
+ throw new Exception( "Tried to promote
'$newName' to a global account except it " .
+ "doesn't exist locally" );
} elseif ( $status->hasMessage(
'promote-already-exists' ) ) {
// Even more wtf.
- throw new Exception( "Tried to prommote
'$newName' to a global account except it already exists" );
+ throw new Exception( "Tried to prommote
'$newName' to a global account except it " .
+ "already exists" );
}
}
diff --git a/includes/SuppressUserJob.php b/includes/SuppressUserJob.php
index d3844bb..dbdd723 100644
--- a/includes/SuppressUserJob.php
+++ b/includes/SuppressUserJob.php
@@ -29,12 +29,18 @@
$reason = $this->params['reason'];
$user = CentralAuthUser::getMasterInstanceByName( $username );
if ( !$user->exists() ) {
- wfDebugLog( 'suppressjob', "Requested to suppress
non-existent user {$username} by {$by}." );
+ wfDebugLog(
+ 'suppressjob', "Requested to suppress
non-existent user {$username} by {$by}."
+ );
}
foreach ( $wikis as $wiki ) {
$user->doLocalSuppression( $suppress, $wiki, $by,
$reason );
- wfDebugLog( 'suppressjob', ( $suppress ? 'S' : 'Uns' )
. "uppressed {$username} at {$wiki} by {$by} via job queue." );
+ wfDebugLog(
+ 'suppressjob',
+ ( $suppress ? 'S' : 'Uns' ) .
+ "uppressed {$username} at {$wiki} by
{$by} via job queue."
+ );
}
return true;
}
diff --git a/includes/session/CentralAuthSessionProvider.php
b/includes/session/CentralAuthSessionProvider.php
index 6b99986..d6587d2 100644
--- a/includes/session/CentralAuthSessionProvider.php
+++ b/includes/session/CentralAuthSessionProvider.php
@@ -43,7 +43,9 @@
];
if ( !is_array( $params['centralCookieOptions'] ) ) {
- throw new \InvalidArgumentException( __METHOD__ . ':
centralCookieOptions must be an array' );
+ throw new \InvalidArgumentException(
+ __METHOD__ . ': centralCookieOptions must be an
array'
+ );
}
$this->centralCookieOptions = $params['centralCookieOptions'];
@@ -151,9 +153,11 @@
return self::returnParentSessionInfo( $request );
}
if ( !User::isUsableName( $userName ) ) {
- $this->logger->warning( __METHOD__ . ': username
{username} is not usable on this wiki', [
- 'username' => $userName,
- ] );
+ $this->logger->warning(
+ __METHOD__ . ': username {username} is not
usable on this wiki', [
+ 'username' => $userName,
+ ]
+ );
return self::returnParentSessionInfo( $request );
}
@@ -208,7 +212,8 @@
} else {
$centralUser =
CentralAuthUser::getInstanceByName( $name );
if ( $centralUser->exists() &&
- ( $centralUser->isAttached() ||
!User::idFromName( $name, User::READ_LATEST ) )
+ ( $centralUser->isAttached() ||
+ !User::idFromName(
$name, User::READ_LATEST ) )
) {
$source = 'CentralAuth';
} else {
@@ -217,7 +222,8 @@
}
if ( $metadata['CentralAuthSource'] !== $source
) {
$this->logger->warning(
- 'Session "{session}":
CentralAuth saved source {saved} != expected source {expected}',
+ 'Session "{session}":
CentralAuth saved source {saved} ' .
+ '!= expected source
{expected}',
[
'session' => $info,
'saved' =>
$metadata['CentralAuthSource'],
@@ -271,7 +277,9 @@
return parent::cookieDataToExport( $user, $remember );
}
- public function persistSession( MediaWiki\Session\SessionBackend
$session, WebRequest $request ) {
+ public function persistSession(
+ MediaWiki\Session\SessionBackend $session, WebRequest $request
+ ) {
parent::persistSession( $session, $request );
if ( !$this->enable ) {
@@ -452,7 +460,8 @@
protected function setLoggedOutCookie( $loggedOut, WebRequest $request
) {
if ( $loggedOut + 86400 > time() &&
- $loggedOut !== (int)$this->getCookie( $request,
'LoggedOut', $this->centralCookieOptions['prefix'] )
+ $loggedOut !== (int)$this->getCookie(
+ $request, 'LoggedOut',
$this->centralCookieOptions['prefix'] )
) {
CentralAuthUtils::setP3P( $request );
$request->response()->setCookie( 'LoggedOut',
$loggedOut, $loggedOut + 86400,
@@ -478,7 +487,9 @@
if ( $name !== null ) {
$name = User::getCanonicalName( $name, 'usable' );
}
- return ( $name === false || $name === null ) ?
parent::suggestLoginUsername( $request ) : $name;
+ return ( $name === false || $name === null )
+ ? parent::suggestLoginUsername( $request )
+ : $name;
}
/**
diff --git a/includes/session/CentralAuthTokenSessionProvider.php
b/includes/session/CentralAuthTokenSessionProvider.php
index e974191..cbde2a2 100644
--- a/includes/session/CentralAuthTokenSessionProvider.php
+++ b/includes/session/CentralAuthTokenSessionProvider.php
@@ -105,7 +105,9 @@
// Skip if they're being renamed
if ( $centralUser->renameInProgress() ) {
$this->logger->debug( __METHOD__ . ': rename in
progress' );
- return $this->makeException( 'renameinprogress',
'apierror-centralauth-renameinprogress' );
+ return $this->makeException(
+ 'renameinprogress',
'apierror-centralauth-renameinprogress'
+ );
}
if ( !$centralUser->exists() ) {
@@ -152,7 +154,9 @@
return false;
}
- public function persistSession( MediaWiki\Session\SessionBackend
$session, WebRequest $request ) {
+ public function persistSession(
+ MediaWiki\Session\SessionBackend $session, WebRequest $request
+ ) {
// Nothing to do
}
@@ -228,7 +232,9 @@
* @return bool
*/
public function onBeforePageDisplay( $out ) {
- if ( $out->getRequest()->getSession()->getProvider() instanceof
CentralAuthTokenSessionProvider ) {
+ if ( $out->getRequest()->getSession()->getProvider()
+ instanceof CentralAuthTokenSessionProvider
+ ) {
$out->reduceAllowedModules(
ResourceLoaderModule::TYPE_SCRIPTS,
ResourceLoaderModule::ORIGIN_USER_SITEWIDE
);
diff --git a/includes/specials/SpecialCentralAuth.php
b/includes/specials/SpecialCentralAuth.php
index 35f8d40..b839af0 100644
--- a/includes/specials/SpecialCentralAuth.php
+++ b/includes/specials/SpecialCentralAuth.php
@@ -37,11 +37,15 @@
$this->mCanOversight = $this->getUser()->isAllowed(
'centralauth-oversight' );
$this->mCanEdit = $this->mCanUnmerge || $this->mCanLock ||
$this->mCanOversight;
- $this->getOutput()->setPageTitle( $this->msg( $this->mCanEdit ?
'centralauth' : 'centralauth-ro' ) );
+ $this->getOutput()->setPageTitle(
+ $this->msg( $this->mCanEdit ? 'centralauth' :
'centralauth-ro' )
+ );
$this->getOutput()->addModules( 'ext.centralauth' );
$this->getOutput()->addModules(
'ext.centralauth.globaluserautocomplete' );
$this->getOutput()->addModuleStyles( 'ext.centralauth.noflash'
);
- $this->getOutput()->addJsConfigVars(
'wgMergeMethodDescriptions', $this->getMergeMethodDescriptions() );
+ $this->getOutput()->addJsConfigVars(
+ 'wgMergeMethodDescriptions',
$this->getMergeMethodDescriptions()
+ );
$this->mUserName =
trim(
@@ -92,7 +96,9 @@
: CentralAuthUser::getInstanceByName( $this->mUserName
);
$this->mGlobalUser = $globalUser;
- if ( ( $globalUser->isOversighted() || $globalUser->isHidden()
) && !$this->mCanOversight ) {
+ if ( ( $globalUser->isOversighted() || $globalUser->isHidden()
) &&
+ !$this->mCanOversight
+ ) {
// Claim that there's nothing if the global account is
hidden and the user is not
// allowed to see it.
$this->showNonexistentError();
@@ -165,9 +171,10 @@
public function doSubmit() {
$deleted = false;
$globalUser = $this->mGlobalUser;
- $stateCheck = ( $this->getRequest()->getVal( 'wpUserState' )
=== $globalUser->getStateHash( true ) );
+ $request = $this->getRequest();
+ $stateCheck = $request->getVal( 'wpUserState' ) ===
$globalUser->getStateHash( true );
- if ( !$this->getUser()->matchEditToken(
$this->getRequest()->getVal( 'wpEditToken' ) ) ) {
+ if ( !$this->getUser()->matchEditToken( $request->getVal(
'wpEditToken' ) ) ) {
$this->showError( 'centralauth-token-mismatch' );
} elseif ( $this->mMethod == 'unmerge' && $this->mCanUnmerge ) {
$status = $globalUser->adminUnattach( $this->mWikis );
@@ -179,7 +186,7 @@
/* deprecated */ $status->successCount
);
}
} elseif ( $this->mMethod == 'delete' && $this->mCanUnmerge ) {
- $status = $globalUser->adminDelete(
$this->getRequest()->getVal( 'reason' ) );
+ $status = $globalUser->adminDelete( $request->getVal(
'reason' ) );
if ( !$status->isGood() ) {
$this->showStatusError( $status->getWikiText()
);
} else {
@@ -189,15 +196,16 @@
} elseif ( $this->mMethod == 'set-status' && !$stateCheck ) {
$this->showError( 'centralauth-state-mismatch' );
} elseif ( $this->mMethod == 'set-status' && $this->mCanLock ) {
- $setLocked = $this->getRequest()->getBool(
'wpStatusLocked' );
- $setHidden = $this->getRequest()->getVal(
'wpStatusHidden' );
- $reason = $this->getRequest()->getText( 'wpReasonList'
);
- $reasonDetail = $this->getRequest()->getText(
'wpReason' );
+ $setLocked = $request->getBool( 'wpStatusLocked' );
+ $setHidden = $request->getVal( 'wpStatusHidden' );
+ $reason = $request->getText( 'wpReasonList' );
+ $reasonDetail = $request->getText( 'wpReason' );
if ( $reason == 'other' ) {
$reason = $reasonDetail;
} elseif ( $reasonDetail ) {
- $reason .= $this->msg( 'colon-separator'
)->inContentLanguage()->text() . $reasonDetail;
+ $reason .= $this->msg( 'colon-separator'
)->inContentLanguage()->text() .
+ $reasonDetail;
}
$status = $globalUser->adminLockHide(
@@ -224,7 +232,9 @@
*/
private function showStatusError( $wikitext ) {
$wrap = Xml::tags( 'div', [ 'class' => 'error' ], $wikitext );
- $this->getOutput()->addHTML( $this->getOutput()->parse( $wrap,
/*linestart*/true, /*uilang*/true ) );
+ $this->getOutput()->addHTML(
+ $this->getOutput()->parse( $wrap, /*linestart*/true,
/*uilang*/true )
+ );
}
private function showError( /* varargs */ ) {
@@ -245,7 +255,8 @@
$html = Xml::openElement( 'form', [ 'method' => 'get', 'action'
=> $wgScript ] );
$html .= Xml::fieldset(
- $this->msg( $this->mCanEdit ?
'centralauth-admin-manage' : 'centralauth-admin-view' )->text(),
+ $this->msg( $this->mCanEdit ?
'centralauth-admin-manage' : 'centralauth-admin-view' )
+ ->text(),
Html::hidden( 'title',
$this->getPageTitle()->getPrefixedText() ) .
Xml::openElement( 'p' ) .
Xml::inputLabel( $this->msg(
'centralauth-admin-username' )->text(),
@@ -324,13 +335,17 @@
$age = $this->prettyTimespan( wfTimestamp( TS_UNIX ) -
wfTimestamp( TS_UNIX, $reg ) );
$attribs = [
'username' => htmlspecialchars( $globalUser->getName()
),
- 'registered' => htmlspecialchars(
$this->getLanguage()->timeanddate( $reg, true ) . " ($age)" ),
- 'editcount' => htmlspecialchars(
$this->getLanguage()->formatNum( $this->evaluateTotalEditcount() ) ),
- 'attached' => htmlspecialchars(
$this->getLanguage()->formatNum( count( $this->mAttachedLocalAccounts ) ) ),
+ 'registered' => htmlspecialchars(
+ $this->getLanguage()->timeanddate( $reg, true )
. " ($age)" ),
+ 'editcount' => htmlspecialchars(
+ $this->getLanguage()->formatNum(
$this->evaluateTotalEditcount() ) ),
+ 'attached' => htmlspecialchars(
+ $this->getLanguage()->formatNum( count(
$this->mAttachedLocalAccounts ) ) ),
];
if ( count( $this->mUnattachedLocalAccounts ) ) {
- $attribs['unattached'] = htmlspecialchars(
$this->getLanguage()->formatNum( count( $this->mUnattachedLocalAccounts ) ) );
+ $attribs['unattached'] = htmlspecialchars(
+ $this->getLanguage()->formatNum( count(
$this->mUnattachedLocalAccounts ) ) );
}
if ( $globalUser->isLocked() ) {
@@ -393,7 +408,8 @@
] );
$header .= Html::hidden( 'wpMethod', 'unmerge' ) .
Html::hidden( 'wpEditToken',
$this->getUser()->getEditToken() ) .
- Xml::openElement( 'table', [ 'class' => 'wikitable
sortable mw-centralauth-wikislist' ] ) .
+ Xml::openElement(
+ 'table', [ 'class' => 'wikitable sortable
mw-centralauth-wikislist' ] ) .
"\n" . Xml::openElement( 'thead' ) . Xml::openElement(
'tr' );
if ( $this->mCanUnmerge && $this->mGlobalUser->exists() ) {
$header .= Xml::openElement( 'th' ) .
Xml::closeElement( 'th' );
@@ -498,7 +514,8 @@
$html = Xml::openElement( 'td', [ 'data-sort-value' =>
'0' ] ) .
$this->msg( 'centralauth-admin-unattached'
)->parse();
} else {
- $html = Xml::openElement( 'td', [ 'data-sort-value' =>
htmlspecialchars( $attachedTimestamp ) ] ) .
+ $html = Xml::openElement( 'td',
+ [ 'data-sort-value' => htmlspecialchars(
$attachedTimestamp ) ] ) .
// visible date and time in users preference
htmlspecialchars(
$this->getLanguage()->timeanddate( $attachedTimestamp, true ) );
}
@@ -515,8 +532,9 @@
global $wgExtensionAssetsPath;
// Give grep a chance to find the usages:
- // centralauth-merge-method-primary,
centralauth-merge-method-empty, centralauth-merge-method-mail,
- // centralauth-merge-method-password,
centralauth-merge-method-admin, centralauth-merge-method-new,
+ // centralauth-merge-method-primary,
centralauth-merge-method-empty,
+ // centralauth-merge-method-mail,
centralauth-merge-method-password,
+ // centralauth-merge-method-admin, centralauth-merge-method-new,
// centralauth-merge-method-login
$brief = wfMessage( "centralauth-merge-method-{$method}"
)->text();
$html =
@@ -547,7 +565,9 @@
$additionalHtml = '';
if ( isset( $row['blocked'] ) && $row['blocked'] ) {
$flags = [];
- foreach ( [ 'anononly', 'nocreate', 'noautoblock',
'noemail', 'nousertalk' ] as $option ) {
+ foreach (
+ [ 'anononly', 'nocreate', 'noautoblock',
'noemail', 'nousertalk' ] as $option
+ ) {
if ( $row['block-' . $option] ) {
$flags[] = $option;
}
@@ -561,7 +581,8 @@
$expiryd = $this->getLanguage()->date(
$row['block-expiry'], true );
$expiryt = $this->getLanguage()->time(
$row['block-expiry'], true );
- $text = $this->msg(
'centralauth-admin-blocked2', $expiry, $expiryd, $expiryt )->parse();
+ $text = $this->msg(
'centralauth-admin-blocked2', $expiry, $expiryd, $expiryt )
+ ->parse();
}
if ( $flags ) {
@@ -729,7 +750,9 @@
Xml::fieldset( $this->msg(
"centralauth-admin-{$action}-title" )->text() ) .
Xml::openElement( 'form', [
'method' => 'POST',
- 'action' => $this->getPageTitle()->getFullUrl(
'target=' . urlencode( $this->mUserName ) ),
+ 'action' => $this->getPageTitle()->getFullUrl(
+ 'target=' . urlencode( $this->mUserName
)
+ ),
'id' => "mw-centralauth-$action" ] ) .
Html::hidden( 'wpMethod', $action ) .
Html::hidden( 'wpEditToken',
$this->getUser()->getEditToken() ) .
@@ -865,8 +888,9 @@
*/
private function getMergeMethodDescriptions() {
// Give grep a chance to find the usages:
- // centralauth-merge-method-primary,
centralauth-merge-method-new, centralauth-merge-method-empty,
- // centralauth-merge-method-password,
centralauth-merge-method-mail, centralauth-merge-method-admin,
+ // centralauth-merge-method-primary,
centralauth-merge-method-new,
+ // centralauth-merge-method-empty,
centralauth-merge-method-password,
+ // centralauth-merge-method-mail,
centralauth-merge-method-admin,
// centralauth-merge-method-login
// Give grep a chance to find the usages:
// centralauth-merge-method-primary-desc,
centralauth-merge-method-new-desc,
@@ -876,7 +900,9 @@
$mergeMethodDescriptions = [];
foreach ( [ 'primary', 'new', 'empty', 'password', 'mail',
'admin', 'login' ] as $method ) {
$mergeMethodDescriptions[$method] = [
- 'short' => $this->getLanguage()->ucfirst(
$this->msg( "centralauth-merge-method-{$method}" )->escaped() ),
+ 'short' => $this->getLanguage()->ucfirst(
+ $this->msg(
"centralauth-merge-method-{$method}" )->escaped()
+ ),
'desc' => $this->msg(
"centralauth-merge-method-{$method}-desc" )->escaped()
];
}
diff --git a/includes/specials/SpecialCentralAutoLogin.php
b/includes/specials/SpecialCentralAutoLogin.php
index 964f3dc..aa96795 100644
--- a/includes/specials/SpecialCentralAutoLogin.php
+++ b/includes/specials/SpecialCentralAutoLogin.php
@@ -66,7 +66,8 @@
if ( !$session->getProvider() instanceof
CentralAuthSessionProvider ) {
$this->doFinalOutput(
false,
- 'Cannot operate when using ' .
$session->getProvider()->describe( Language::factory( 'en' ) ),
+ 'Cannot operate when using ' .
+ $session->getProvider()->describe(
Language::factory( 'en' ) ),
$body,
$type
);
@@ -83,10 +84,12 @@
in_array( $par, [ 'refreshCookies', 'deleteCookies',
'start', 'checkLoggedIn',
'createSession', 'validateSession', 'setCookies' ],
true )
) {
- \MediaWiki\Logger\LoggerFactory::getInstance(
'authevents' )->info( 'Autologin ' . $par, [
- 'event' => 'autologin',
- 'eventType' => $par,
- ] );
+ \MediaWiki\Logger\LoggerFactory::getInstance(
'authevents' )->info(
+ 'Autologin ' . $par, [
+ 'event' => 'autologin',
+ 'eventType' => $par,
+ ]
+ );
}
$request = $this->getRequest();
@@ -101,7 +104,9 @@
if ( $fromwiki !== null && WikiMap::getWiki( $fromwiki
) ) {
$this->loginWiki = $fromwiki;
}
- } elseif ( $request->getVal( 'from' ) === wfWikiId() &&
$wgCentralAuthLoginWiki !== wfWikiId() ) {
+ } elseif ( $request->getVal( 'from' ) === wfWikiId() &&
+ $wgCentralAuthLoginWiki !== wfWikiId()
+ ) {
// Remote wiki must not have wgCentralAuthLoginWiki
set, but we do. Redirect them.
$this->do302Redirect( $wgCentralAuthLoginWiki, $par,
$request->getValues() );
return;
@@ -250,7 +255,8 @@
if ( $this->getUser()->isLoggedIn() ) {
$centralUser = CentralAuthUser::getInstance(
$this->getUser() );
} else {
- $this->doFinalOutput( false, 'Not centrally
logged in', self::getInlineScript( 'anon-set.js' ) );
+ $this->doFinalOutput( false, 'Not centrally
logged in',
+ self::getInlineScript( 'anon-set.js' )
);
return;
}
@@ -311,7 +317,8 @@
}
if ( $gu_id <= 0 ) {
- $this->doFinalOutput( false, 'Not centrally
logged in', self::getInlineScript( 'anon-set.js' ) );
+ $this->doFinalOutput( false, 'Not centrally
logged in',
+ self::getInlineScript( 'anon-set.js' )
);
return;
}
@@ -556,7 +563,9 @@
// via ajax, and update the UI. Don't write out the
tools here (bug 57081).
$code = $this->getUser()->getOption( 'language' );
$code = RequestContext::sanitizeLangCode( $code );
- Hooks::run( 'UserGetLanguageObject', [
$this->getUser(), &$code, $this->getContext() ] );
+ Hooks::run( 'UserGetLanguageObject',
+ [ $this->getUser(), &$code, $this->getContext()
]
+ );
$script .= "\n" . Xml::encodeJsCall(
'mediaWiki.messages.set', [
[
'centralauth-centralautologin-logged-in' =>
diff --git a/includes/specials/SpecialGlobalGroupMembership.php
b/includes/specials/SpecialGlobalGroupMembership.php
index ae48c15..1849c3c 100644
--- a/includes/specials/SpecialGlobalGroupMembership.php
+++ b/includes/specials/SpecialGlobalGroupMembership.php
@@ -40,12 +40,17 @@
$this->getOutput()->addModules(
'ext.centralauth.globaluserautocomplete' );
$this->getOutput()->addModuleStyles( 'mediawiki.special' );
$this->getOutput()->addHTML(
- Xml::openElement( 'form', [ 'method' => 'get', 'action'
=> $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1' ] ) .
+ Xml::openElement( 'form', [
+ 'method' => 'get',
+ 'action' => $wgScript,
+ 'name' => 'uluser',
+ 'id' => 'mw-userrights-form1'
+ ] ) .
Html::hidden( 'title', $this->getPageTitle() ) .
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', [], $this->msg(
'userrights-lookup-user' )->text() ) .
- Xml::inputLabel( $this->msg( 'userrights-user-editname'
)->text(), 'user', 'username', 30, $this->mTarget,
- [ 'class' => 'mw-autocomplete-global-user' ] )
. ' <br />' .
+ Xml::inputLabel( $this->msg( 'userrights-user-editname'
)->text(), 'user', 'username',
+ 30, $this->mTarget, [ 'class' =>
'mw-autocomplete-global-user' ] ) . ' <br />' .
Xml::submitButton( $this->msg( 'editusergroup'
)->text() ) .
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' ) . "\n"
diff --git a/includes/specials/SpecialGlobalGroupPermissions.php
b/includes/specials/SpecialGlobalGroupPermissions.php
index f324782..306c63c 100644
--- a/includes/specials/SpecialGlobalGroupPermissions.php
+++ b/includes/specials/SpecialGlobalGroupPermissions.php
@@ -92,8 +92,13 @@
// @todo Move this out of main view to a separate page
$html = Xml::fieldset( $this->msg(
'centralauth-newgroup-legend' )->text() );
$html .= $this->msg( 'centralauth-newgroup-intro'
)->parseAsBlock();
- $html .= Xml::openElement( 'form', [ 'method' =>
'post', 'action' => $wgScript, 'name' => 'centralauth-globalgroups-newgroup' ]
);
- $html .= Html::hidden( 'title',
SpecialPage::getTitleFor( 'GlobalGroupPermissions' )->getPrefixedText() );
+ $html .= Xml::openElement( 'form', [
+ 'method' => 'post',
+ 'action' => $wgScript,
+ 'name' => 'centralauth-globalgroups-newgroup'
+ ] );
+ $html .= Html::hidden( 'title',
+ SpecialPage::getTitleFor(
'GlobalGroupPermissions' )->getPrefixedText() );
$fields = [ 'centralauth-globalgroupperms-newgroupname'
=> Xml::input( 'wpGroup' ) ];
@@ -110,7 +115,8 @@
* @return string HTML for the group permissions table
*/
protected function getGlobalGroupsTable( $groups ) {
- $table = Html::openElement( 'table', [ 'class' =>
'mw-centralauth-groups-table wikitable' ] );
+ $table = Html::openElement( 'table',
+ [ 'class' => 'mw-centralauth-groups-table wikitable' ]
);
// Header stuff
$table .= Html::openElement( 'tr' );
@@ -130,7 +136,8 @@
// Column with group name, links and local disabled
status
$table .= Html::openElement( 'td' );
- $table .= $this->getOutput()->parseInline(
User::makeGroupLinkWiki( $groupName ) ) . '<br />';
+ $table .= $this->getOutput()->parseInline(
User::makeGroupLinkWiki( $groupName ) ) .
+ '<br />';
$linkRenderer = $this->getLinkRenderer();
$links = [
@@ -143,11 +150,13 @@
$this->msg(
'centralauth-globalgroupperms-group-listmembers' )->text()
),
];
- $table .= $this->msg( 'parentheses' )->rawParams(
$this->getLanguage()->pipeList( $links ) )->escaped();
+ $table .= $this->msg( 'parentheses' )
+ ->rawParams( $this->getLanguage()->pipeList(
$links ) )->escaped();
if ( $wikiset !== null && !$wikiset['enabledHere'] ) {
$table .= '<br /><small>';
- $table .= $this->msg(
'centralauth-globalgroupperms-group-disabled' )->escaped() . '</small>';
+ $table .= $this->msg(
'centralauth-globalgroupperms-group-disabled' )->escaped() .
+ '</small>';
}
$table .= Html::closeElement( 'td' );
@@ -219,13 +228,20 @@
$this->getOutput()->addBacklinkSubtitle( $this->getPageTitle()
);
- $fieldsetClass = $editable ? 'mw-centralauth-editgroup' :
'mw-centralauth-editgroup-readonly';
- $html = Xml::fieldset( $this->msg(
'centralauth-editgroup-fieldset', $group )->text(), false, [ 'class' =>
$fieldsetClass ] );
+ $fieldsetClass = $editable
+ ? 'mw-centralauth-editgroup'
+ : 'mw-centralauth-editgroup-readonly';
+ $html = Xml::fieldset(
+ $this->msg( 'centralauth-editgroup-fieldset', $group
)->text(),
+ false,
+ [ 'class' => $fieldsetClass ]
+ );
if ( $editable ) {
$html .= Xml::openElement( 'form', [
'method' => 'post',
- 'action' => SpecialPage::getTitleFor(
'GlobalGroupPermissions', $group )->getLocalUrl(),
+ 'action' =>
+ SpecialPage::getTitleFor(
'GlobalGroupPermissions', $group )->getLocalUrl(),
'name' => 'centralauth-globalgroups-newgroup'
] );
$html .= Html::hidden( 'wpGroup', $group );
@@ -253,8 +269,10 @@
UserGroupMembership::getGroupMemberName(
$group, '#' )
)->parse();
} else {
- $fields['centralauth-editgroup-display'] =
htmlspecialchars( UserGroupMembership::getGroupName( $group ) );
- $fields['centralauth-editgroup-member'] =
htmlspecialchars( UserGroupMembership::getGroupMemberName( $group, '#' ) );
+ $fields['centralauth-editgroup-display'] =
+ htmlspecialchars(
UserGroupMembership::getGroupName( $group ) );
+ $fields['centralauth-editgroup-member'] =
+ htmlspecialchars(
UserGroupMembership::getGroupMemberName( $group, '#' ) );
}
$fields['centralauth-editgroup-members'] = $this->msg(
'centralauth-editgroup-members-link',
@@ -348,8 +366,11 @@
$label = Xml::tags( 'label', [ 'for' =>
"wpRightAssigned-$right" ],
$desc );
- $liClass = $checked ?
'mw-centralauth-editgroup-checked' : 'mw-centralauth-editgroup-unchecked';
- $checkboxes[] = Html::rawElement( 'li', [ 'class' =>
$liClass ], "$checkbox $label" );
+ $liClass = $checked
+ ? 'mw-centralauth-editgroup-checked'
+ : 'mw-centralauth-editgroup-unchecked';
+ $checkboxes[] = Html::rawElement(
+ 'li', [ 'class' => $liClass ],
"$checkbox $label" );
}
$count = count( $checkboxes );
@@ -453,7 +474,9 @@
if ( !$alreadyAssigned &&
$this->getRequest()->getCheck( "wpRightAssigned-$right" ) ) {
$addRights[] = $right;
- } elseif ( $alreadyAssigned &&
!$this->getRequest()->getCheck( "wpRightAssigned-$right" ) ) {
+ } elseif ( $alreadyAssigned &&
+ !$this->getRequest()->getCheck(
"wpRightAssigned-$right" )
+ ) {
$removeRights[] = $right;
} # Otherwise, do nothing.
}
@@ -494,7 +517,11 @@
$dbw = CentralAuthUtils::getCentralDB();
# Delete from the DB
- $dbw->delete( 'global_group_permissions', [ 'ggp_group' =>
$group, 'ggp_permission' => $rights ], __METHOD__ );
+ $dbw->delete(
+ 'global_group_permissions',
+ [ 'ggp_group' => $group, 'ggp_permission' => $rights ],
+ __METHOD__
+ );
}
/**
@@ -514,7 +541,12 @@
}
# Replace into the DB
- $dbw->replace( 'global_group_permissions', [ 'ggp_group',
'ggp_permission' ], $insertRows, __METHOD__ );
+ $dbw->replace(
+ 'global_group_permissions',
+ [ 'ggp_group', 'ggp_permission' ],
+ $insertRows,
+ __METHOD__
+ );
}
/**
@@ -599,7 +631,9 @@
* @return string
*/
function makeRightsList( $ids ) {
- return (bool)count( $ids ) ? implode( ', ', $ids ) :
$this->msg( 'rightsnone' )->inContentLanguage()->text();
+ return (bool)count( $ids )
+ ? implode( ', ', $ids )
+ : $this->msg( 'rightsnone'
)->inContentLanguage()->text();
}
/**
@@ -646,7 +680,12 @@
// renamed groups
$dbr = CentralAuthUtils::getCentralDB();
- $res = $dbr->select( [ 'global_user_groups', 'globaluser' ],
'gu_name', [ 'gug_group' => $group, 'gu_id=gug_user' ], __METHOD__ );
+ $res = $dbr->select(
+ [ 'global_user_groups', 'globaluser' ],
+ 'gu_name',
+ [ 'gug_group' => $group, 'gu_id=gug_user' ],
+ __METHOD__
+ );
// Invalidate their rights cache.
foreach ( $res as $row ) {
diff --git a/includes/specials/SpecialGlobalRenameProgress.php
b/includes/specials/SpecialGlobalRenameProgress.php
index 07ed130..8df5bdc 100644
--- a/includes/specials/SpecialGlobalRenameProgress.php
+++ b/includes/specials/SpecialGlobalRenameProgress.php
@@ -35,7 +35,8 @@
$out = $this->getOutput();
LogEventsList::showLogExtract( $out, 'gblrename', $caTitle, '',
[
'showIfEmpty' => true, // @todo set this to false and
don't show the fieldset
- 'wrap' => Xml::fieldset( $this->msg(
'centralauth-rename-progress-logs-fieldset' )->text(), '$1' ),
+ 'wrap' => Xml::fieldset(
+ $this->msg(
'centralauth-rename-progress-logs-fieldset' )->text(), '$1' ),
] );
}
@@ -136,14 +137,16 @@
ksort( $statuses );
$table = Html::openElement( 'table', [ 'class' => 'wikitable
sortable' ] );
$table .= Html::openElement( 'tr' );
- $table .= Html::element( 'th', [], $this->msg(
'centralauth-rename-table-domain' )->text() );
- $table .= Html::element( 'th', [], $this->msg(
'centralauth-rename-table-status' )->text() );
+ $table .= Html::element( 'th', [],
+ $this->msg( 'centralauth-rename-table-domain' )->text()
);
+ $table .= Html::element( 'th', [],
+ $this->msg( 'centralauth-rename-table-status' )->text()
);
$table .= Html::closeElement( 'tr' );
foreach ( $statuses as $wiki => $status ) {
$wikiReference = WikiMap::getWiki( $wiki );
if ( !$wikiReference ) {
- LoggerFactory::getInstance( 'CentralAuth'
)->warning( __METHOD__ . ': invalid wiki: '
- . $wiki );
+ LoggerFactory::getInstance( 'CentralAuth'
)->warning( __METHOD__ .
+ ': invalid wiki: ' . $wiki );
continue;
}
@@ -151,11 +154,13 @@
$table .= Html::element( 'td', [],
$wikiReference->getDisplayName() );
// Messages used:
centralauth-rename-table-status-inprogress
// centralauth-rename-table-status-queued,
centralauth-rename-table-status-done
- $table .= Html::rawElement( 'td', [], $this->msg(
"centralauth-rename-table-status-$status" )->parse() );
+ $table .= Html::rawElement( 'td', [],
+ $this->msg(
"centralauth-rename-table-status-$status" )->parse() );
$table .= Html::closeElement( 'tr' );
}
$table .= Html::closeElement( 'table' );
- $fieldset = Xml::fieldset( $this->msg(
'centralauth-rename-progress-fieldset' )->text(), $table );
+ $fieldset = Xml::fieldset(
+ $this->msg( 'centralauth-rename-progress-fieldset'
)->text(), $table );
$this->showLogExtract( $newName );
$out->addHTML( $fieldset );
diff --git a/includes/specials/SpecialGlobalRenameQueue.php
b/includes/specials/SpecialGlobalRenameQueue.php
index 220fe75..36a5a92 100644
--- a/includes/specials/SpecialGlobalRenameQueue.php
+++ b/includes/specials/SpecialGlobalRenameQueue.php
@@ -267,7 +267,8 @@
$renamer = CentralAuthUser::newFromId( $req->getPerformer() );
if ( $renamer === false ) {
throw new Exception(
- "The perfomer's global user id
({$req->getPerformer()}) does not exist in the database"
+ "The perfomer's global user id
({$req->getPerformer()}) " .
+ "does not exist in the database"
);
}
if ( $renamer->isAttached() ) {
@@ -389,7 +390,8 @@
$req->getName(),
$req->getNewName()
);
- $form->addHeaderText( '<span class="plainlinks">' .
$headerMsg->parseAsBlock() . '</span>' );
+ $form->addHeaderText( '<span class="plainlinks">' .
$headerMsg->parseAsBlock() .
+ '</span>' );
$homeWikiWiki = WikiMap::getWiki( $homeWiki );
$infoMsg = $this->msg( $infoMsgKey,
@@ -411,7 +413,8 @@
// @todo move this code somewhere else
$specialGblRename = new SpecialGlobalRenameUser();
$specialGblRename->setContext( $this->getContext() );
- $conflicts =
$specialGblRename->processAntiSpoofConflicts( $req->getName(),
$spoofUser->getConflicts() );
+ $conflicts =
$specialGblRename->processAntiSpoofConflicts( $req->getName(),
+ $spoofUser->getConflicts() );
if ( $conflicts ) {
$form->addHeaderText(
$this->msg(
@@ -895,7 +898,8 @@
'rq_name' => $this->msg(
'globalrenamequeue-column-rq-name' )->text(),
'rq_newname' => $this->msg(
'globalrenamequeue-column-rq-newname' )->text(),
'rq_wiki' => $this->msg(
'globalrenamequeue-column-rq-wiki' )->text(),
- 'rq_requested_ts' => $this->msg(
'globalrenamequeue-column-rq-requested-ts' )->text(),
+ 'rq_requested_ts' =>
+ $this->msg(
'globalrenamequeue-column-rq-requested-ts' )->text(),
'row_actions' => $this->msg(
'globalrenamequeue-column-row-actions' )->text(),
];
@@ -904,7 +908,8 @@
array_pop( $this->mFieldNames );
$this->mFieldNames += [
- 'rq_completed_ts' => $this->msg(
'globalrenamequeue-column-rq-completed-ts' )->text(),
+ 'rq_completed_ts' =>
+ $this->msg(
'globalrenamequeue-column-rq-completed-ts' )->text(),
'rq_status' => $this->msg(
'globalrenamequeue-column-rq-status' )->text(),
'rq_performer' => $this->msg(
'globalrenamequeue-column-rq-performer' )->text(),
'row_actions' => $this->msg(
'globalrenamequeue-column-row-actions' )->text(),
diff --git a/includes/specials/SpecialGlobalRenameUser.php
b/includes/specials/SpecialGlobalRenameUser.php
index 2f65884..4df7ae6 100644
--- a/includes/specials/SpecialGlobalRenameUser.php
+++ b/includes/specials/SpecialGlobalRenameUser.php
@@ -169,12 +169,16 @@
}
}
- // Let the performer know that olduser's editcount is more than
the sysadmin-intervention-threshold
- // and do the rename only if we've received confirmation that
they want to do it.
+ // Let the performer know that olduser's editcount is more than
the
+ // sysadmin-intervention-threshold and do the rename only if
we've received
+ // confirmation that they want to do it.
$caOldUser = CentralAuthUser::getInstance( $oldUser );
- if ( !$this->allowHighEditcount &&
$caOldUser->getGlobalEditCount() > self::EDITCOUNT_THRESHOLD ) {
+ if ( !$this->allowHighEditcount &&
+ $caOldUser->getGlobalEditCount() >
self::EDITCOUNT_THRESHOLD
+ ) {
return Status::newFatal(
- $this->msg(
'centralauth-rename-globaleditcount-threshold' )->numParams(
self::EDITCOUNT_THRESHOLD )
+ $this->msg(
'centralauth-rename-globaleditcount-threshold' )
+ ->numParams( self::EDITCOUNT_THRESHOLD )
);
}
@@ -203,7 +207,8 @@
*
* @param string $oldname User's old (current) name
* @param array $conflicts Conflicting usernames
- * @return array Usernames that are safe to display - non-hidden
usernames are linked to Special:CA
+ * @return array Usernames that are safe to display -
+ * non-hidden usernames are linked to Special:CentralAuth
*/
public function processAntiSpoofConflicts( $oldname, array $conflicts )
{
$display = [];
diff --git a/includes/specials/SpecialGlobalUsers.php
b/includes/specials/SpecialGlobalUsers.php
index a94a827..8b3c745 100644
--- a/includes/specials/SpecialGlobalUsers.php
+++ b/includes/specials/SpecialGlobalUsers.php
@@ -119,7 +119,8 @@
'gu_id' => 'MAX(gu_id)',
'gu_locked' => 'MAX(gu_locked)',
'lu_attached_method' =>
'MAX(lu_attached_method)',
- 'gug_group' => 'GROUP_CONCAT(gug_group
SEPARATOR \'|\')' ], // | cannot be used in a group name
+ // | cannot be used in a group name
+ 'gug_group' => 'GROUP_CONCAT(gug_group
SEPARATOR \'|\')' ],
'conds' => $conds,
'options' => [ 'GROUP BY' => 'gu_name' ],
'join_conds' => [
@@ -151,13 +152,15 @@
}
$info = $this->getLanguage()->commaList( $info );
- return Html::rawElement( 'li', [], $this->msg(
'centralauth-listusers-item', $user, $info )->parse() );
+ return Html::rawElement( 'li', [],
+ $this->msg( 'centralauth-listusers-item', $user, $info
)->parse() );
}
function doBatchLookups() {
$batch = new LinkBatch();
foreach ( $this->mResult as $row ) {
- $batch->addObj( Title::makeTitleSafe( NS_USER,
$row->gu_name ) ); // userpage existence link cache
+ // userpage existence link cache
+ $batch->addObj( Title::makeTitleSafe( NS_USER,
$row->gu_name ) );
if ( $row->gug_group ) { // no point in adding users
that belong to any group
$this->globalIDGroups[$row->gu_id] = explode(
'|', $row->gug_group );
}
diff --git a/includes/specials/SpecialMergeAccount.php
b/includes/specials/SpecialMergeAccount.php
index c3c0b2d..de1b807 100644
--- a/includes/specials/SpecialMergeAccount.php
+++ b/includes/specials/SpecialMergeAccount.php
@@ -1,7 +1,13 @@
<?php
class SpecialMergeAccount extends SpecialPage {
- protected $mUserName, $mAttemptMerge, $mMergeAction, $mPassword,
$mWikiIDs, $mSessionToken, $mSessionKey;
+ protected $mUserName;
+ protected $mAttemptMerge;
+ protected $mMergeAction;
+ protected $mPassword;
+ protected $mWikiIDs;
+ protected $mSessionToken;
+ protected $mSessionKey;
public function __construct() {
parent::__construct( 'MergeAccount', 'centralauth-merge' );
@@ -35,7 +41,9 @@
if ( !$this->getUser()->isLoggedIn() ) {
$loginpage = SpecialPage::getTitleFor( 'Userlogin' );
- $loginurl = $loginpage->getFullUrl( [ 'returnto' =>
$this->getPageTitle()->getPrefixedText() ] );
+ $loginurl = $loginpage->getFullUrl(
+ [ 'returnto' =>
$this->getPageTitle()->getPrefixedText() ]
+ );
$this->getOutput()->addWikiMsg(
'centralauth-merge-notlogged', $loginurl );
$this->getOutput()->addWikiMsg(
'centralauth-readmore-text' );
@@ -47,16 +55,17 @@
$this->getOutput()->addWikiMsg( 'readonlytext',
CentralAuthUtils::getReadOnlyReason() );
return;
}
+ $request = $this->getRequest();
$this->mUserName = $this->getUser()->getName();
- $this->mAttemptMerge = $this->getRequest()->wasPosted();
+ $this->mAttemptMerge = $request->wasPosted();
- $this->mMergeAction = $this->getRequest()->getVal(
'wpMergeAction' );
- $this->mPassword = $this->getRequest()->getVal( 'wpPassword' );
- $this->mWikiIDs = $this->getRequest()->getArray( 'wpWikis' );
- $this->mSessionToken = $this->getRequest()->getVal(
'wpMergeSessionToken' );
- $this->mSessionKey = pack( "H*", $this->getRequest()->getVal(
'wpMergeSessionKey' ) );
+ $this->mMergeAction = $request->getVal( 'wpMergeAction' );
+ $this->mPassword = $request->getVal( 'wpPassword' );
+ $this->mWikiIDs = $request->getArray( 'wpWikis' );
+ $this->mSessionToken = $request->getVal( 'wpMergeSessionToken'
);
+ $this->mSessionKey = pack( "H*", $request->getVal(
'wpMergeSessionKey' ) );
// Possible demo states
@@ -71,7 +80,7 @@
if ( $this->mAttemptMerge ) {
// First check the edit token
- if ( !$this->getUser()->matchEditToken(
$this->getRequest()->getVal( 'wpEditToken' ) ) ) {
+ if ( !$this->getUser()->matchEditToken(
$request->getVal( 'wpEditToken' ) ) ) {
throw new ErrorPageError(
'sessionfailure-title', 'sessionfailure' );
}
switch ( $this->mMergeAction ) {
@@ -219,7 +228,9 @@
$attached = [];
$unattached = [];
$methods = [];
- $status = $globalUser->migrationDryRun( $passwords, $home,
$attached, $unattached, $methods );
+ $status = $globalUser->migrationDryRun(
+ $passwords, $home, $attached, $unattached, $methods
+ );
if ( $status->isGood() ) {
// This is the global account or matched it
@@ -245,7 +256,8 @@
// Show wiki list if required
if ( $status->hasMessage(
'centralauth-merge-home-password' ) ) {
- $out = Html::rawElement( 'h2', null,
$this->msg( 'centralauth-list-home-title' )->escaped() );
+ $out = Html::rawElement( 'h2', null,
+ $this->msg(
'centralauth-list-home-title' )->escaped() );
$out .= $this->msg(
'centralauth-list-home-dryrun' )->parseAsBlock();
$out .= $this->listAttached( [ $home ], [ $home
=> 'primary' ] );
$this->getOutput()->addHTML( $out );
@@ -496,7 +508,9 @@
// centralauth-merge-method-admin,
centralauth-merge-method-new,
// centralauth-merge-method-login,
$return .= $this->msg( 'word-separator' )->escaped();
- $return .= $this->msg( 'parentheses', $this->msg(
'centralauth-merge-method-'.$method )->text() )->escaped();
+ $return .= $this->msg( 'parentheses',
+ $this->msg( 'centralauth-merge-method-' .
$method )->text()
+ )->escaped();
}
return $return;
}
@@ -598,7 +612,8 @@
return $this->passwordForm(
'dryrun',
$this->msg( 'centralauth-merge-step2-title' )->text(),
- $this->msg( 'centralauth-merge-step2-detail',
$this->getUser()->getName() )->parseAsBlock() .
+ $this->msg( 'centralauth-merge-step2-detail',
+ $this->getUser()->getName() )->parseAsBlock() .
$this->listUnattached( $unattached ),
$this->msg( 'centralauth-merge-step2-submit' )->text()
);
}
diff --git a/includes/specials/SpecialMultiLock.php
b/includes/specials/SpecialMultiLock.php
index b8953f8..a5e017a 100644
--- a/includes/specials/SpecialMultiLock.php
+++ b/includes/specials/SpecialMultiLock.php
@@ -41,7 +41,8 @@
if ( $this->mReason == 'other' ) {
$this->mReason = $reasonDetail;
} elseif ( $reasonDetail ) {
- $this->mReason .= $this->msg( 'colon-separator'
)->inContentLanguage()->text() . $reasonDetail;
+ $this->mReason .= $this->msg( 'colon-separator'
)->inContentLanguage()->text() .
+ $reasonDetail;
}
if ( $this->mUserNames !== '' ) {
@@ -63,8 +64,12 @@
} elseif ( $this->mPosted && $this->mMethod == 'search' &&
$this->mPrefixSearch !== '' ) {
$this->searchForUsers();
$this->showUserTable();
- } elseif ( $this->mPosted && $this->mMethod == 'set-status' &&
is_array( $this->mActionUserNames ) ) {
- $this->mGlobalUsers = array_unique(
$this->getGlobalUsers( $this->mActionUserNames, true ), SORT_REGULAR );
+ } elseif ( $this->mPosted && $this->mMethod == 'set-status' &&
+ is_array( $this->mActionUserNames )
+ ) {
+ $this->mGlobalUsers = array_unique(
+ $this->getGlobalUsers( $this->mActionUserNames,
true ), SORT_REGULAR
+ );
$this->setStatus();
$this->showUserTable();
} else {
@@ -97,7 +102,8 @@
? CentralAuthUser::getMasterInstanceByName(
$username )
: CentralAuthUser::getInstanceByName( $username
);
if ( !$globalUser->exists()
- || ( !$this->mCanOversight && (
$globalUser->isOversighted() || $globalUser->isHidden() ) )
+ || ( !$this->mCanOversight &&
+ ( $globalUser->isOversighted() ||
$globalUser->isHidden() ) )
) {
$ret[] = $this->msg(
'centralauth-admin-nonexistent', $username )->parse();
} else {
@@ -196,7 +202,8 @@
$this->msg( 'centralauth-admin-reason-other-select'
)->inContentLanguage()->text()
);
$reasonField = Xml::input( 'wpReason', 45, false );
- $botField = Xml::check( 'markasbot' ) . $this->msg(
'centralauth-admin-multi-botcheck' )->parse();
+ $botField = Xml::check( 'markasbot' ) .
+ $this->msg( 'centralauth-admin-multi-botcheck'
)->parse();
$form .= Xml::buildForm(
[
@@ -274,7 +281,9 @@
* Build the table of users to lock and/or hide
*/
private function showUserTable() {
- $this->mGlobalUsers = array_unique( $this->getGlobalUsers(
$this->mUserNames ), SORT_REGULAR );
+ $this->mGlobalUsers = array_unique(
+ $this->getGlobalUsers( $this->mUserNames ), SORT_REGULAR
+ );
$out = $this->getOutput();
@@ -334,7 +343,8 @@
$guLocked = $this->msg(
'centralauth-admin-status-locked-yes' )->text();
}
$guEditCount = $this->getLanguage()->formatNum(
$globalUser->getGlobalEditCount() );
- $guAttachedLocalAccounts = $this->getLanguage()->formatNum(
count( $globalUser->listAttached() ) );
+ $guAttachedLocalAccounts = $this->getLanguage()
+ ->formatNum( count( $globalUser->listAttached() ) );
$rowHtml .= Html::rawElement( 'td', [],
Html::input(
'wpActionTarget['.$guName.']',
@@ -417,7 +427,9 @@
*/
function showStatusError( $wikitext ) {
$wrap = Xml::tags( 'div', [ 'class' => 'error' ], $wikitext );
- $this->getOutput()->addHTML( $this->getOutput()->parse( $wrap,
/*linestart*/true, /*uilang*/true ) );
+ $this->getOutput()->addHTML(
+ $this->getOutput()->parse( $wrap, /*linestart*/true,
/*uilang*/true )
+ );
}
function showError( /* varargs */ ) {
@@ -446,7 +458,8 @@
Xml::element( 'p', [],
$this->msg(
'centralauth-admin-multi-username' )->text()
) .
- Xml::textarea( 'wpTarget', (
$this->mPrefixSearch ? '' : $this->mUserNames ), 25, 20 ) .
+ Xml::textarea( 'wpTarget',
+ ( $this->mPrefixSearch ? '' :
$this->mUserNames ), 25, 20 ) .
Xml::element( 'p', [],
$this->msg(
'centralauth-admin-multi-searchprefix' )->text()
) .
diff --git a/includes/specials/SpecialWikiSets.php
b/includes/specials/SpecialWikiSets.php
index 4180979..9227b20 100644
--- a/includes/specials/SpecialWikiSets.php
+++ b/includes/specials/SpecialWikiSets.php
@@ -48,7 +48,9 @@
} else {
$newPage = ( $subpage === '0' && $this->mCanEdit );
if ( $subpage ) {
- $set = is_numeric( $subpage ) ?
WikiSet::newFromId( $subpage ) : WikiSet::newFromName( $subpage );
+ $set = is_numeric( $subpage )
+ ? WikiSet::newFromId( $subpage )
+ : WikiSet::newFromName( $subpage );
if ( $set ) {
$subpage = $set->getID();
} else {
@@ -73,30 +75,37 @@
* @param string $msg Output directly as HTML. Caller must escape.
*/
function buildMainView( $msg = '' ) {
- // Give grep a chance to find the usages:
centralauth-editset-legend-rw, centralauth-editset-legend-ro
+ // Give grep a chance to find the usages:
centralauth-editset-legend-rw,
+ // centralauth-editset-legend-ro
$msgPostfix = $this->mCanEdit ? 'rw' : 'ro';
$legend = $this->msg(
"centralauth-editset-legend-{$msgPostfix}" )->escaped();
$this->getOutput()->addHTML(
"<fieldset><legend>{$legend}</legend>" );
if ( $msg ) {
$this->getOutput()->addHTML( $msg );
}
- // Give grep a chance to find the usages:
centralauth-editset-intro-rw, centralauth-editset-intro-ro
+ // Give grep a chance to find the usages:
centralauth-editset-intro-rw,
+ // centralauth-editset-intro-ro
$this->getOutput()->addWikiMsg(
"centralauth-editset-intro-{$msgPostfix}" );
$this->getOutput()->addHTML( '<ul>' );
- // Give grep a chance to find the usages:
centralauth-editset-item-rw, centralauth-editset-item-ro
+ // Give grep a chance to find the usages:
centralauth-editset-item-rw,
+ // centralauth-editset-item-ro
$sets = WikiSet::getAllWikiSets();
/**
* @var $set WikiSet
*/
foreach ( $sets as $set ) {
- $text = $this->msg(
"centralauth-editset-item-{$msgPostfix}", $set->getName(), $set->getID()
)->parse();
+ $text = $this->msg(
"centralauth-editset-item-{$msgPostfix}",
+ $set->getName(), $set->getID() )->parse();
$this->getOutput()->addHTML( "<li>{$text}</li>" );
}
if ( $this->mCanEdit ) {
$target = SpecialPage::getTitleFor( 'WikiSets', '0' );
- $newlink = $this->getLinkRenderer()->makeLink( $target,
$this->msg( 'centralauth-editset-new' )->text() );
+ $newlink = $this->getLinkRenderer()->makeLink(
+ $target,
+ $this->msg( 'centralauth-editset-new' )->text()
+ );
$this->getOutput()->addHTML( "<li>{$newlink}</li>" );
}
@@ -111,7 +120,9 @@
* @param array|null $wikis
* @param string $reason
*/
- function buildSetView( $subpage, $error = false, $name = null, $type =
null, $wikis = null, $reason = null ) {
+ function buildSetView(
+ $subpage, $error = false, $name = null, $type = null, $wikis =
null, $reason = null
+ ) {
global $wgLocalDatabases;
$this->getOutput()->setSubtitle( $this->msg(
'centralauth-editset-subtitle' )->parse() );
@@ -133,7 +144,10 @@
if ( $this->mCanEdit ) {
// Give grep a chance to find the usages:
// centralauth-editset-legend-edit,
centralauth-editset-legend-new
- $legend = $this->msg( 'centralauth-editset-legend-' . (
$set ? 'edit' : 'new' ), $name )->escaped();
+ $legend = $this->msg(
+ 'centralauth-editset-legend-' . ( $set ? 'edit'
: 'new' ),
+ $name
+ )->escaped();
} else {
$legend = $this->msg(
'centralauth-editset-legend-view', $name )->escaped();
}
@@ -145,7 +159,8 @@
if ( $groups ) {
$usage = "<ul>\n";
foreach ( $groups as $group ) {
- $usage .= "<li>" . $this->msg(
'centralauth-editset-grouplink', $group )->parse() . "</li>\n";
+ $usage .= "<li>" . $this->msg(
'centralauth-editset-grouplink', $group )
+ ->parse() . "</li>\n";
}
$usage .= "</ul>";
} else {
@@ -195,13 +210,19 @@
$edittoken = Html::hidden( 'wpEditToken',
$this->getUser()->getEditToken() );
$this->getOutput()->addHTML(
"<p>{$edittoken}</p></form></fieldset>" );
} else {
- // Give grep a chance to find the usages:
centralauth-editset-optin, centralauth-editset-optout
+ // Give grep a chance to find the usages:
centralauth-editset-optin,
+ // centralauth-editset-optout
$form = [];
$form['centralauth-editset-name'] = htmlspecialchars(
$name );
$form['centralauth-editset-usage'] = $usage;
- $form['centralauth-editset-type'] = $this->msg(
"centralauth-editset-{$type}" )->escaped();
- $form['centralauth-editset-wikis'] =
self::buildTableByList( $sortedWikis, 3, [ 'width' => '100%' ] );
- $form['centralauth-editset-restwikis'] =
self::buildTableByList( $restWikis, 3, [ 'width' => '100%' ] );
+ $form['centralauth-editset-type'] = $this->msg(
"centralauth-editset-{$type}" )
+ ->escaped();
+ $form['centralauth-editset-wikis'] =
self::buildTableByList(
+ $sortedWikis, 3, [ 'width' => '100%' ]
+ );
+ $form['centralauth-editset-restwikis'] =
self::buildTableByList(
+ $restWikis, 3, [ 'width' => '100%' ]
+ );
$this->getOutput()->addHTML( Xml::buildForm( $form ) );
}
@@ -215,7 +236,8 @@
* @return string
*/
function buildTypeSelector( $name, $value ) {
- // Give grep a chance to find the usages:
centralauth-editset-optin, centralauth-editset-optout
+ // Give grep a chance to find the usages:
centralauth-editset-optin,
+ // centralauth-editset-optout
$select = new XmlSelect( $name, 'set-type', $value );
foreach ( [ WikiSet::OPTIN, WikiSet::OPTOUT ] as $type ) {
$select->addOption( $this->msg(
"centralauth-editset-{$type}" )->text(), $type );
@@ -274,16 +296,23 @@
$set = WikiSet::newFromID( $subpage );
if ( !$set ) {
- $this->buildMainView( '<strong class="error">' .
$this->msg( 'centralauth-editset-notfound', $subpage )->escaped() . '</strong>'
);
+ $this->buildMainView( '<strong class="error">' .
+ $this->msg( 'centralauth-editset-notfound',
$subpage )->escaped() .
+ '</strong>'
+ );
return;
}
$legend = $this->msg( 'centralauth-editset-legend-delete',
$set->getName() )->escaped();
$form = [ 'centralauth-editset-reason' => Xml::input(
'wpReason' ) ];
- $url = htmlspecialchars( SpecialPage::getTitleFor( 'WikiSets',
"delete/{$subpage}" )->getLocalUrl() );
+ $url = htmlspecialchars(
+ SpecialPage::getTitleFor( 'WikiSets',
"delete/{$subpage}" )->getLocalUrl()
+ );
$edittoken = Html::hidden( 'wpEditToken',
$this->getUser()->getEditToken() );
- $this->getOutput()->addHTML(
"<fieldset><legend>{$legend}</legend><form action=\"{$url}\" method='post'>" );
+ $this->getOutput()->addHTML(
+ "<fieldset><legend>{$legend}</legend><form
action=\"{$url}\" method='post'>"
+ );
$this->getOutput()->addHTML( Xml::buildForm( $form,
'centralauth-editset-submit-delete' ) );
$this->getOutput()->addHTML(
"<p>{$edittoken}</p></form></fieldset>" );
}
@@ -296,24 +325,30 @@
$name = $wgContLang->ucfirst( $this->getRequest()->getVal(
'wpName' ) );
$type = $this->getRequest()->getVal( 'wpType' );
- $wikis = array_unique( preg_split( '/(\s+|\s*\W\s*)/',
$this->getRequest()->getVal( 'wpWikis' ), -1, PREG_SPLIT_NO_EMPTY ) );
+ $wikis = array_unique( preg_split(
+ '/(\s+|\s*\W\s*)/', $this->getRequest()->getVal(
'wpWikis' ), -1, PREG_SPLIT_NO_EMPTY )
+ );
$reason = $this->getRequest()->getVal( 'wpReason' );
$set = WikiSet::newFromId( $id );
if ( !Title::newFromText( $name ) ) {
- $this->buildSetView( $id, $this->msg(
'centralauth-editset-badname' )->escaped(), $name, $type, $wikis, $reason );
+ $this->buildSetView( $id, $this->msg(
'centralauth-editset-badname' )->escaped(),
+ $name, $type, $wikis, $reason );
return;
}
if ( ( !$id || $set->getName() != $name ) &&
WikiSet::newFromName( $name ) ) {
- $this->buildSetView( $id, $this->msg(
'centralauth-editset-setexists' )->escaped(), $name, $type, $wikis, $reason );
+ $this->buildSetView( $id, $this->msg(
'centralauth-editset-setexists' )->escaped(),
+ $name, $type, $wikis, $reason );
return;
}
if ( !in_array( $type, [ WikiSet::OPTIN, WikiSet::OPTOUT ] ) ) {
- $this->buildSetView( $id, $this->msg(
'centralauth-editset-badtype' )->escaped(), $name, $type, $wikis, $reason );
+ $this->buildSetView( $id, $this->msg(
'centralauth-editset-badtype' )->escaped(),
+ $name, $type, $wikis, $reason );
return;
}
if ( !$wikis ) {
- $this->buildSetView( $id, $this->msg(
'centralauth-editset-zerowikis' )->escaped(), $name, $type, $wikis, $reason );
+ $this->buildSetView( $id, $this->msg(
'centralauth-editset-zerowikis' )->escaped(),
+ $name, $type, $wikis, $reason );
return;
}
$badwikis = [];
@@ -371,7 +406,10 @@
$returnLink = $this->getLinkRenderer()->makeKnownLink(
$this->getPageTitle(), $this->msg(
'centralauth-editset-return' )->text() );
- $this->getOutput()->addHTML( '<strong class="success">' .
$this->msg( 'centralauth-editset-success' )->escaped() . '</strong> <p>' .
$returnLink . '</p>' );
+ $this->getOutput()->addHTML( '<strong class="success">' .
+ $this->msg( 'centralauth-editset-success' )->escaped()
. '</strong> <p>' . $returnLink .
+ '</p>'
+ );
}
/**
@@ -380,7 +418,9 @@
function doDelete( $set ) {
$set = WikiSet::newFromID( $set );
if ( !$set ) {
- $this->buildMainView( '<strong class="error">' .
$this->msg( 'centralauth-editset-notfound', $set )->escaped() . '</strong>' );
+ $this->buildMainView( '<strong class="error">' .
+ $this->msg( 'centralauth-editset-notfound',
$set )->escaped() . '</strong>'
+ );
return;
}
@@ -392,7 +432,9 @@
$log = new LogPage( 'gblrights' );
$log->addEntry( 'deleteset', $title, $reason, [ $name ] );
- $this->buildMainView( '<strong class="success">' . $this->msg(
'centralauth-editset-success-delete' )->escaped() . '</strong>' );
+ $this->buildMainView( '<strong class="success">' .
+ $this->msg( 'centralauth-editset-success-delete'
)->escaped() . '</strong>'
+ );
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/364128
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4dd48bea826310fda99ac9f7d416a687636c3bda
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits