diff --git a/includes/EditPage.php b/includes/EditPage.php
index 31f3f392ba3..569cebe2913 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -2501,7 +2501,7 @@ class EditPage implements IEditObject {
*/
protected function updateWatchlist() {
$user = $this->context->getUser();
- if ( !$user->isLoggedIn() ) {
+ if ( !$user->isRegistered() ) {
return;
}
@@ -2771,7 +2771,7 @@ class EditPage implements IEditObject {
$ip = User::isIP( $username );
$block = DatabaseBlock::newFromTarget( $user, $user );
- $userExists = ( $user && $user->isLoggedIn() );
+ $userExists = ( $user && $user->isRegistered() );
if ( $userExists && $user->isHidden() &&
!$this->permManager->userHasRight( $this->context->getUser(), 'hideuser' )
) {
@@ -2812,7 +2812,7 @@ class EditPage implements IEditObject {
$helpLink = wfExpandUrl( Skin::makeInternalOrExternalUrl(
$this->context->msg( 'helppage' )->inContentLanguage()->text()
) );
- if ( $this->context->getUser()->isLoggedIn() ) {
+ if ( $this->context->getUser()->isRegistered() ) {
$out->wrapWikiMsg(
// Suppress the external link icon, consider the help url an internal one
"
\n$1\n
",
@@ -4351,7 +4351,7 @@ class EditPage implements IEditObject {
];
}
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$checkboxes = array_merge(
$checkboxes,
$this->getCheckboxesDefinitionForWatchlist( $checked['watch'] )
diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php
index e37483ea2f1..05f9df5e501 100644
--- a/includes/FileDeleteForm.php
+++ b/includes/FileDeleteForm.php
@@ -344,7 +344,7 @@ class FileDeleteForm {
);
}
- if ( $this->user->isLoggedIn() ) {
+ if ( $this->user->isRegistered() ) {
$fields[] = new OOUI\FieldLayout(
new OOUI\CheckboxInputWidget( [
'name' => 'wpWatch',
diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 037af293570..13aeee49744 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -1001,7 +1001,7 @@ class MediaWiki {
$request->getCookie( 'forceHTTPS', '' ) ||
// Avoid checking the user and groups unless it's enabled.
(
- $this->context->getUser()->isLoggedIn()
+ $this->context->getUser()->isRegistered()
&& $this->context->getUser()->requiresHTTPS()
);
}
@@ -1010,7 +1010,7 @@ class MediaWiki {
* If the stars are suitably aligned, do an HTTP->HTTPS redirect
*
* Note: Do this after $wgTitle is setup, otherwise the hooks run from
- * isLoggedIn() will do all sorts of weird stuff.
+ * isRegistered() will do all sorts of weird stuff.
*
* @return bool True if the redirect was done. Handling of the request
* should be aborted. False if no redirect was done.
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index e8372cc9874..d3c685ae31e 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -2930,7 +2930,7 @@ class OutputPage extends ContextSource {
[], // modules; not relevant
$this->getLanguage()->getCode(),
$this->getSkin()->getSkinName(),
- $this->getUser()->isLoggedIn() ? $this->getUser()->getName() : null,
+ $this->getUser()->isRegistered() ? $this->getUser()->getName() : null,
null, // version; not relevant
ResourceLoader::inDebugMode(),
null, // only; not relevant
@@ -3341,7 +3341,7 @@ class OutputPage extends ContextSource {
'wgRelevantPageName' => $relevantTitle->getPrefixedDBkey(),
'wgRelevantArticleId' => $relevantTitle->getArticleID(),
];
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$vars['wgUserId'] = $user->getId();
$vars['wgUserEditCount'] = $user->getEditCount();
$userReg = $user->getRegistration();
@@ -3452,7 +3452,7 @@ class OutputPage extends ContextSource {
$user = $this->getUser();
- if ( !$user->isLoggedIn() ) {
+ if ( !$user->isRegistered() ) {
// Anons have predictable edit tokens
return false;
}
diff --git a/includes/Permissions/PermissionManager.php b/includes/Permissions/PermissionManager.php
index 324e3050c3d..91abf765978 100644
--- a/includes/Permissions/PermissionManager.php
+++ b/includes/Permissions/PermissionManager.php
@@ -1347,7 +1347,7 @@ class PermissionManager {
);
if (
- $user->isLoggedIn() &&
+ $user->isRegistered() &&
$this->options->get( 'BlockDisablesLogin' ) &&
$user->getBlock()
) {
diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php
index 22cbbb8c396..81a13b9ccd1 100644
--- a/includes/ProtectionForm.php
+++ b/includes/ProtectionForm.php
@@ -552,8 +552,8 @@ class ProtectionForm {
'id' => 'mwProtect-reason', 'maxlength' => $maxlength ] ) .
"
";
- # Disallow watching is user is not logged in
- if ( $user->isLoggedIn() ) {
+ # Disallow watching is user is not registered
+ if ( $user->isRegistered() ) {
$out .= "
|
diff --git a/includes/Storage/DerivedPageDataUpdater.php b/includes/Storage/DerivedPageDataUpdater.php
index 3bf4d340a19..5675e2ecb78 100644
--- a/includes/Storage/DerivedPageDataUpdater.php
+++ b/includes/Storage/DerivedPageDataUpdater.php
@@ -1585,7 +1585,7 @@ class DerivedPageDataUpdater implements IDBAccessObject, LoggerAwareInterface {
if ( User::isIP( $shortTitle ) ) {
// An anonymous user
$talkPageNotificationManager->setUserHasNewMessages( $recipient, $revRecord );
- } elseif ( $recipient->isLoggedIn() ) {
+ } elseif ( $recipient->isRegistered() ) {
$talkPageNotificationManager->setUserHasNewMessages( $recipient, $revRecord );
} else {
wfDebug( __METHOD__ . ": don't need to notify a nonexistent user" );
diff --git a/includes/actions/CreditsAction.php b/includes/actions/CreditsAction.php
index 749f4ce02bd..f19c2dcf4de 100644
--- a/includes/actions/CreditsAction.php
+++ b/includes/actions/CreditsAction.php
@@ -135,7 +135,7 @@ class CreditsAction extends FormlessAction {
/** @var User $user */
foreach ( $contributors as $user ) {
$cnt--;
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$link = $this->link( $user );
if ( $this->canShowRealUserName() && $user->getRealName() ) {
$real_names[] = $link;
diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php
index 2391890ad61..8af5540883e 100644
--- a/includes/actions/RawAction.php
+++ b/includes/actions/RawAction.php
@@ -93,8 +93,8 @@ class RawAction extends FormlessAction {
// vary generated content for open sessions on private wikis
$privateCache = !$permissionManager->isEveryoneAllowed( 'read' ) &&
( $smaxage == 0 || MediaWiki\Session\SessionManager::getGlobalSession()->isPersistent() );
- // Don't accidentally cache cookies if user is logged in (T55032)
- $privateCache = $privateCache || $this->getUser()->isLoggedIn();
+ // Don't accidentally cache cookies if user is registered (T55032)
+ $privateCache = $privateCache || $this->getUser()->isRegistered();
$mode = $privateCache ? 'private' : 'public';
$response->header(
'Cache-Control: ' . $mode . ', s-maxage=' . $smaxage . ', max-age=' . $maxage
diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php
index 28a0fc54440..ad5cab2e268 100644
--- a/includes/actions/WatchAction.php
+++ b/includes/actions/WatchAction.php
@@ -244,8 +244,8 @@ class WatchAction extends FormAction {
User $user,
string $expiry = null
) {
- // User must be logged in, and either changing the watch state or at least the expiry.
- if ( !$user->isLoggedIn() ) {
+ // User must be registered, and either changing the watch state or at least the expiry.
+ if ( !$user->isRegistered() ) {
return Status::newGood();
}
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index 4029d775f58..0a807eb83fc 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1139,7 +1139,7 @@ abstract class ApiBase extends ContextSource {
$this->dieWithError( 'apierror-bad-watchlist-token', 'bad_wltoken' );
}
} else {
- if ( !$this->getUser()->isLoggedIn() ) {
+ if ( !$this->getUser()->isRegistered() ) {
$this->dieWithError( 'watchlistanontext', 'notloggedin' );
}
$this->checkUserRightsAny( 'viewmywatchlist' );
diff --git a/includes/api/ApiChangeAuthenticationData.php b/includes/api/ApiChangeAuthenticationData.php
index f8bacce2abb..6b029a2d848 100644
--- a/includes/api/ApiChangeAuthenticationData.php
+++ b/includes/api/ApiChangeAuthenticationData.php
@@ -35,7 +35,7 @@ class ApiChangeAuthenticationData extends ApiBase {
}
public function execute() {
- if ( !$this->getUser()->isLoggedIn() ) {
+ if ( !$this->getUser()->isRegistered() ) {
$this->dieWithError( 'apierror-mustbeloggedin-changeauthenticationdata', 'notloggedin' );
}
diff --git a/includes/api/ApiLinkAccount.php b/includes/api/ApiLinkAccount.php
index f6fe36bd6d8..5f7569f34dd 100644
--- a/includes/api/ApiLinkAccount.php
+++ b/includes/api/ApiLinkAccount.php
@@ -49,7 +49,7 @@ class ApiLinkAccount extends ApiBase {
}
public function execute() {
- if ( !$this->getUser()->isLoggedIn() ) {
+ if ( !$this->getUser()->isRegistered() ) {
$this->dieWithError( 'apierror-mustbeloggedin-linkaccounts', 'notloggedin' );
}
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 15490a72d59..2a5c48ebf56 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -1565,7 +1565,7 @@ class ApiMain extends ApiBase {
(
$this->getConfig()->get( 'ForceHTTPS' ) ||
$request->getSession()->shouldForceHTTPS() ||
- ( $this->getUser()->isLoggedIn() &&
+ ( $this->getUser()->isRegistered() &&
$this->getUser()->requiresHTTPS() )
)
) {
diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php
index 2385ac77799..e1d3d4d4651 100644
--- a/includes/api/ApiQueryInfo.php
+++ b/includes/api/ApiQueryInfo.php
@@ -298,7 +298,7 @@ class ApiQueryInfo extends ApiQueryBase {
* @param User $user
*/
public static function getWatchToken( User $user ) {
- if ( !$user->isLoggedIn() ) {
+ if ( !$user->isRegistered() ) {
return false;
}
@@ -316,7 +316,7 @@ class ApiQueryInfo extends ApiQueryBase {
* @param User $user
*/
public static function getOptionsToken( User $user ) {
- if ( !$user->isLoggedIn() ) {
+ if ( !$user->isRegistered() ) {
return false;
}
diff --git a/includes/api/ApiQueryStashImageInfo.php b/includes/api/ApiQueryStashImageInfo.php
index e91c34f870e..3e70ec52036 100644
--- a/includes/api/ApiQueryStashImageInfo.php
+++ b/includes/api/ApiQueryStashImageInfo.php
@@ -34,7 +34,7 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
}
public function execute() {
- if ( !$this->getUser()->isLoggedIn() ) {
+ if ( !$this->getUser()->isRegistered() ) {
$this->dieWithError( 'apierror-mustbeloggedin-uploadstash', 'notloggedin' );
}
diff --git a/includes/api/ApiRemoveAuthenticationData.php b/includes/api/ApiRemoveAuthenticationData.php
index 3354bbaa27f..f5b0ed62bd6 100644
--- a/includes/api/ApiRemoveAuthenticationData.php
+++ b/includes/api/ApiRemoveAuthenticationData.php
@@ -46,7 +46,7 @@ class ApiRemoveAuthenticationData extends ApiBase {
}
public function execute() {
- if ( !$this->getUser()->isLoggedIn() ) {
+ if ( !$this->getUser()->isRegistered() ) {
$this->dieWithError( 'apierror-mustbeloggedin-removeauth', 'notloggedin' );
}
diff --git a/includes/api/ApiUpload.php b/includes/api/ApiUpload.php
index c64f8bb7056..d803af10049 100644
--- a/includes/api/ApiUpload.php
+++ b/includes/api/ApiUpload.php
@@ -560,7 +560,7 @@ class ApiUpload extends ApiBase {
$permission = $this->mUpload->isAllowed( $user );
if ( $permission !== true ) {
- if ( !$user->isLoggedIn() ) {
+ if ( !$user->isRegistered() ) {
$this->dieWithError( [ 'apierror-mustbeloggedin', $this->msg( 'action-upload' ) ] );
}
diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php
index b7546305b58..cb21431f161 100644
--- a/includes/api/ApiWatch.php
+++ b/includes/api/ApiWatch.php
@@ -46,7 +46,7 @@ class ApiWatch extends ApiBase {
public function execute() {
$user = $this->getUser();
- if ( !$user->isLoggedIn() ) {
+ if ( !$user->isRegistered() ) {
$this->dieWithError( 'watchlistanontext', 'notloggedin' );
}
diff --git a/includes/changes/CategoryMembershipChange.php b/includes/changes/CategoryMembershipChange.php
index 6d0405741ae..1026e3a1767 100644
--- a/includes/changes/CategoryMembershipChange.php
+++ b/includes/changes/CategoryMembershipChange.php
@@ -242,7 +242,7 @@ class CategoryMembershipChange {
$username = wfMessage( 'autochange-username' )->inContentLanguage()->text();
$user = User::newFromName( $username );
# User::newFromName() can return false on a badly configured wiki.
- if ( $user && !$user->isLoggedIn() ) {
+ if ( $user && !$user->isRegistered() ) {
$user->addToDatabase();
}
diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php
index 9eef68cfd17..647845fbe65 100644
--- a/includes/htmlform/HTMLForm.php
+++ b/includes/htmlform/HTMLForm.php
@@ -583,7 +583,7 @@ class HTMLForm extends ContextSource {
$tokenOkay = true; // no session check needed
} elseif ( $this->getRequest()->wasPosted() ) {
$editToken = $this->getRequest()->getVal( 'wpEditToken' );
- if ( $this->getUser()->isLoggedIn() || $editToken !== null ) {
+ if ( $this->getUser()->isRegistered() || $editToken !== null ) {
// Session tokens for logged-out users have no security value.
// However, if the user gave one, check it in order to give a nice
// "session expired" error instead of "permission denied" or such.
diff --git a/includes/jobqueue/jobs/AssembleUploadChunksJob.php b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
index 35625cf8f4a..8e72959b196 100644
--- a/includes/jobqueue/jobs/AssembleUploadChunksJob.php
+++ b/includes/jobqueue/jobs/AssembleUploadChunksJob.php
@@ -42,7 +42,7 @@ class AssembleUploadChunksJob extends Job {
$context = RequestContext::getMain();
$user = $context->getUser();
try {
- if ( !$user->isLoggedIn() ) {
+ if ( !$user->isRegistered() ) {
$this->setLastError( "Could not load the author user from session." );
return false;
diff --git a/includes/jobqueue/jobs/DoubleRedirectJob.php b/includes/jobqueue/jobs/DoubleRedirectJob.php
index 91d03aae0f2..377347a8d29 100644
--- a/includes/jobqueue/jobs/DoubleRedirectJob.php
+++ b/includes/jobqueue/jobs/DoubleRedirectJob.php
@@ -248,7 +248,7 @@ class DoubleRedirectJob extends Job {
$username = wfMessage( 'double-redirect-fixer' )->inContentLanguage()->text();
self::$user = User::newFromName( $username );
# User::newFromName() can return false on a badly configured wiki.
- if ( self::$user && !self::$user->isLoggedIn() ) {
+ if ( self::$user && !self::$user->isRegistered() ) {
self::$user->addToDatabase();
}
}
diff --git a/includes/jobqueue/jobs/PublishStashedFileJob.php b/includes/jobqueue/jobs/PublishStashedFileJob.php
index 49c08e30f42..ae07e884bf2 100644
--- a/includes/jobqueue/jobs/PublishStashedFileJob.php
+++ b/includes/jobqueue/jobs/PublishStashedFileJob.php
@@ -44,7 +44,7 @@ class PublishStashedFileJob extends Job {
$context = RequestContext::getMain();
$user = $context->getUser();
try {
- if ( !$user->isLoggedIn() ) {
+ if ( !$user->isRegistered() ) {
$this->setLastError( "Could not load the author user from session." );
return false;
diff --git a/includes/language/LanguageConverter.php b/includes/language/LanguageConverter.php
index a270149c4a3..b1bf28fb3e5 100644
--- a/includes/language/LanguageConverter.php
+++ b/includes/language/LanguageConverter.php
@@ -198,7 +198,7 @@ abstract class LanguageConverter implements ILanguageConverter {
// NOTE: For calls from Setup.php, wgUser or the session might not be set yet (T235360)
// Use case: During autocreation, User::isUsableName is called which uses interface
// messages for reserved usernames.
- if ( $wgUser && $wgUser->isSafeToLoad() && $wgUser->isLoggedIn() && !$req ) {
+ if ( $wgUser && $wgUser->isSafeToLoad() && $wgUser->isRegistered() && !$req ) {
$req = $this->getUserVariant( $wgUser );
} elseif ( !$req ) {
$req = $this->getHeaderVariant();
@@ -311,7 +311,7 @@ abstract class LanguageConverter implements ILanguageConverter {
return false;
}
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
// Get language variant preference from logged in users
if (
$this->mMainLanguageCode ==
diff --git a/includes/page/Article.php b/includes/page/Article.php
index a9e9e9de73e..2de648234a7 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -292,7 +292,7 @@ class Article implements Page {
$content = ContentHandler::makeContent( $text, $this->getTitle() );
} else {
- $message = $this->getContext()->getUser()->isLoggedIn() ? 'noarticletext' : 'noarticletextanon';
+ $message = $this->getContext()->getUser()->isRegistered() ? 'noarticletext' : 'noarticletextanon';
$content = new MessageContent( $message, null );
}
@@ -1374,7 +1374,7 @@ class Article implements Page {
$ip = User::isIP( $rootPart );
$block = DatabaseBlock::newFromTarget( $user, $user );
- if ( $user && $user->isLoggedIn() && $user->isHidden() &&
+ if ( $user && $user->isRegistered() && $user->isHidden() &&
!$services->getPermissionManager()
->userHasRight( $contextUser, 'hideuser' )
) {
@@ -1382,7 +1382,7 @@ class Article implements Page {
// users, pretend like it does not exist at all.
$user = false;
}
- if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist
+ if ( !( $user && $user->isRegistered() ) && !$ip ) { # User does not exist
$outputPage->wrapWikiMsg( "\n\$1\n
",
[ 'userpage-userdoesnotexist-view', wfEscapeWikiText( $rootPart ) ] );
} elseif (
@@ -1420,10 +1420,10 @@ class Article implements Page {
# so be careful showing this. 404 pages must be cheap as they are hard to cache.
$dbCache = ObjectCache::getInstance( 'db-replicated' );
$key = $dbCache->makeKey( 'page-recent-delete', md5( $title->getPrefixedText() ) );
- $loggedIn = $contextUser->isLoggedIn();
+ $isRegistered = $contextUser->isRegistered();
$sessionExists = $this->getContext()->getRequest()->getSession()->isPersistent();
- if ( $loggedIn || $dbCache->get( $key ) || $sessionExists ) {
+ if ( $isRegistered || $dbCache->get( $key ) || $sessionExists ) {
$logTypes = [ 'delete', 'move', 'protect' ];
$dbr = wfGetDB( DB_REPLICA );
@@ -1440,7 +1440,7 @@ class Article implements Page {
'lim' => 10,
'conds' => $conds,
'showIfEmpty' => false,
- 'msgKey' => [ $loggedIn || $sessionExists
+ 'msgKey' => [ $isRegistered || $sessionExists
? 'moveddeleted-notice'
: 'moveddeleted-notice-recent'
]
@@ -1494,7 +1494,7 @@ class Article implements Page {
} elseif ( $pm->quickUserCan( 'create', $contextUser, $title ) &&
$pm->quickUserCan( 'edit', $contextUser, $title )
) {
- $message = $loggedIn ? 'noarticletext' : 'noarticletextanon';
+ $message = $isRegistered ? 'noarticletext' : 'noarticletextanon';
$text = wfMessage( $message )->plain();
} else {
$text = wfMessage( 'noarticletext-nopermission' )->plain();
@@ -2077,7 +2077,7 @@ class Article implements Page {
]
);
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$fields[] = new OOUI\FieldLayout(
new OOUI\CheckboxInputWidget( [
'name' => 'wpWatch',
diff --git a/includes/search/searchwidgets/SearchFormWidget.php b/includes/search/searchwidgets/SearchFormWidget.php
index 83d80f799b5..56f791fbc70 100644
--- a/includes/search/searchwidgets/SearchFormWidget.php
+++ b/includes/search/searchwidgets/SearchFormWidget.php
@@ -69,7 +69,7 @@ class SearchFormWidget {
[
'id' => $isPowerSearch ? 'powersearch' : 'search',
// T151903: default to POST in case JS is disabled
- 'method' => ( $isPowerSearch && $user->isLoggedIn() ) ? 'post' : 'get',
+ 'method' => ( $isPowerSearch && $user->isRegistered() ) ? 'post' : 'get',
'action' => wfScript(),
]
) .
@@ -309,7 +309,7 @@ class SearchFormWidget {
// Stuff to feed SpecialSearch::saveNamespaces()
$user = $this->specialSearch->getUser();
$remember = '';
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$remember = $divider . Xml::checkLabel(
$this->specialSearch->msg( 'powersearch-remember' )->text(),
'nsRemember',
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index ecebf617c13..3a430064fb0 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -284,7 +284,7 @@ abstract class Skin extends ContextSource {
$services = MediaWikiServices::getInstance();
$permManager = $services->getPermissionManager();
- if ( $user->isLoggedIn()
+ if ( $user->isRegistered()
&& $permManager->userHasAllRights( $user, 'writeapi', 'viewmywatchlist', 'editmywatchlist' )
&& $this->getRelevantTitle()->canExist()
) {
@@ -313,7 +313,7 @@ abstract class Skin extends ContextSource {
// User/talk link
$user = $this->getUser();
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$titles[] = $user->getUserPage();
$titles[] = $user->getTalkPage();
}
@@ -428,7 +428,7 @@ abstract class Skin extends ContextSource {
if ( $user ) {
$user->load( User::READ_NORMAL );
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$this->mRelevantUser = $user;
}
}
@@ -2036,7 +2036,7 @@ abstract class Skin extends ContextSource {
$siteNotice = '';
if ( $this->getHookRunner()->onSiteNoticeBefore( $siteNotice, $this ) ) {
- if ( $this->getUser()->isLoggedIn() ) {
+ if ( $this->getUser()->isRegistered() ) {
$siteNotice = $this->getCachedNotice( 'sitenotice' );
} else {
$anonNotice = $this->getCachedNotice( 'anonnotice' );
diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php
index cf89dea9641..c39c7f38ef7 100644
--- a/includes/skins/SkinTemplate.php
+++ b/includes/skins/SkinTemplate.php
@@ -49,6 +49,7 @@ class SkinTemplate extends Skin {
public $titletxt;
public $userpage;
public $thisquery;
+ // TODO: Rename this to $isRegistered (but that's a breaking change)
public $loggedin;
public $username;
public $userpageUrlDetails;
@@ -105,7 +106,7 @@ class SkinTemplate extends Skin {
unset( $query['returntoquery'] );
}
$this->thisquery = wfArrayToCgi( $query );
- $this->loggedin = $user->isLoggedIn();
+ $this->loggedin = $user->isRegistered();
$this->username = $user->getName();
if ( $this->loggedin ) {
diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php
index 70ac88672d1..5e16a5b81e2 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -191,7 +191,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
'cssClassSuffix' => 'user-newcomer',
'isRowApplicableCallable' => function ( $ctx, $rc ) {
$performer = $rc->getPerformer();
- return $performer && $performer->isLoggedIn() &&
+ return $performer && $performer->isRegistered() &&
$performer->getExperienceLevel() === 'newcomer';
}
],
@@ -202,7 +202,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
'cssClassSuffix' => 'user-learner',
'isRowApplicableCallable' => function ( $ctx, $rc ) {
$performer = $rc->getPerformer();
- return $performer && $performer->isLoggedIn() &&
+ return $performer && $performer->isRegistered() &&
$performer->getExperienceLevel() === 'learner';
},
],
@@ -213,7 +213,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
'cssClassSuffix' => 'user-experienced',
'isRowApplicableCallable' => function ( $ctx, $rc ) {
$performer = $rc->getPerformer();
- return $performer && $performer->isLoggedIn() &&
+ return $performer && $performer->isRegistered() &&
$performer->getExperienceLevel() === 'experienced';
},
]
diff --git a/includes/specialpage/LoginSignupSpecialPage.php b/includes/specialpage/LoginSignupSpecialPage.php
index 68c0db031a1..db8e3918879 100644
--- a/includes/specialpage/LoginSignupSpecialPage.php
+++ b/includes/specialpage/LoginSignupSpecialPage.php
@@ -265,7 +265,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
*/
if ( !$this->isSignup() && !$this->mPosted && !$this->securityLevel &&
( $this->mReturnTo !== '' || $this->mReturnToQuery !== '' ) &&
- $this->getUser()->isLoggedIn()
+ $this->getUser()->isRegistered()
) {
$this->successfulAction();
return;
@@ -569,7 +569,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
// warning header for non-standard workflows (e.g. security reauthentication)
if (
!$this->isSignup() &&
- $this->getUser()->isLoggedIn() &&
+ $this->getUser()->isRegistered() &&
$this->authAction !== AuthManager::ACTION_LOGIN_CONTINUE
) {
$reauthMessage = $this->securityLevel ? 'userlogin-reauth' : 'userlogin-loggedin';
@@ -729,9 +729,9 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
protected function getFieldDefinitions() {
global $wgEmailConfirmToEdit;
- $isLoggedIn = $this->getUser()->isLoggedIn();
+ $isRegistered = $this->getUser()->isRegistered();
$continuePart = $this->isContinued() ? 'continue-' : '';
- $anotherPart = $isLoggedIn ? 'another-' : '';
+ $anotherPart = $isRegistered ? 'another-' : '';
// @phan-suppress-next-line PhanUndeclaredMethod
$expiration = $this->getRequest()->getSession()->getProvider()->getRememberUserDuration();
$expirationDays = ceil( $expiration / ( 3600 * 24 ) );
@@ -762,7 +762,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
'username' => [
'label-raw' => $this->msg( 'userlogin-yourname' )->escaped() . $usernameHelpLink,
'id' => 'wpName2',
- 'placeholder-message' => $isLoggedIn ? 'createacct-another-username-ph'
+ 'placeholder-message' => $isRegistered ? 'createacct-another-username-ph'
: 'userlogin-yourname-ph',
],
'mailpassword' => [
@@ -838,7 +838,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
],
'realname' => [
'type' => 'text',
- 'help-message' => $isLoggedIn ? 'createacct-another-realname-tip'
+ 'help-message' => $isRegistered ? 'createacct-another-realname-tip'
: 'prefs-help-realname',
'label-message' => 'createacct-realname',
'cssclass' => 'loginText',
@@ -1029,26 +1029,26 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
if ( $this->mLanguage ) {
$linkq .= '&uselang=' . urlencode( $this->mLanguage );
}
- $loggedIn = $this->getUser()->isLoggedIn();
+ $isRegistered = $this->getUser()->isRegistered();
$fieldDefinitions['createOrLogin'] = [
'type' => 'info',
'raw' => true,
'linkQuery' => $linkq,
- 'default' => function ( $params ) use ( $loggedIn, $linkTitle ) {
+ 'default' => function ( $params ) use ( $isRegistered, $linkTitle ) {
return Html::rawElement( 'div',
- [ 'id' => 'mw-createaccount' . ( !$loggedIn ? '-cta' : '' ),
- 'class' => ( $loggedIn ? 'mw-form-related-link-container' : 'mw-ui-vform-field' ) ],
- ( $loggedIn ? '' : $this->msg( 'userlogin-noaccount' )->escaped() )
+ [ 'id' => 'mw-createaccount' . ( !$isRegistered ? '-cta' : '' ),
+ 'class' => ( $isRegistered ? 'mw-form-related-link-container' : 'mw-ui-vform-field' ) ],
+ ( $isRegistered ? '' : $this->msg( 'userlogin-noaccount' )->escaped() )
. Html::element( 'a',
[
- 'id' => 'mw-createaccount-join' . ( $loggedIn ? '-loggedin' : '' ),
+ 'id' => 'mw-createaccount-join' . ( $isRegistered ? '-loggedin' : '' ),
'href' => $linkTitle->getLocalURL( $params['linkQuery'] ),
- 'class' => ( $loggedIn ? '' : 'mw-ui-button' ),
+ 'class' => ( $isRegistered ? '' : 'mw-ui-button' ),
'tabindex' => 100,
],
$this->msg(
- $loggedIn ? 'userlogin-createanother' : 'userlogin-joinproject'
+ $isRegistered ? 'userlogin-createanother' : 'userlogin-joinproject'
)->text()
)
);
@@ -1190,7 +1190,7 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
!$this->isSignup()
) {
$user = $this->getUser();
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$formDescriptor['username']['default'] = $user->getName();
} else {
$formDescriptor['username']['default'] =
diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php
index 95ca1979708..e1829a8213f 100644
--- a/includes/specials/SpecialBlock.php
+++ b/includes/specials/SpecialBlock.php
@@ -351,7 +351,7 @@ class SpecialBlock extends FormSpecialPage {
}
# Watchlist their user page? (Only if user is logged in)
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$a['Watch'] = [
'type' => 'check',
'label-message' => 'ipbwatchuser',
diff --git a/includes/specials/SpecialConfirmEmail.php b/includes/specials/SpecialConfirmEmail.php
index c15b7969c41..fa3fb29a541 100644
--- a/includes/specials/SpecialConfirmEmail.php
+++ b/includes/specials/SpecialConfirmEmail.php
@@ -185,10 +185,10 @@ class SpecialConfirmEmail extends UnlistedSpecialPage {
$userLatest = $user->getInstanceForUpdate();
$userLatest->confirmEmail();
$userLatest->saveSettings();
- $message = $this->getUser()->isLoggedIn() ? 'confirmemail_loggedin' : 'confirmemail_success';
+ $message = $this->getUser()->isRegistered() ? 'confirmemail_loggedin' : 'confirmemail_success';
$this->getOutput()->addWikiMsg( $message );
- if ( !$this->getUser()->isLoggedIn() ) {
+ if ( !$this->getUser()->isRegistered() ) {
$title = SpecialPage::getTitleFor( 'Userlogin' );
$this->getOutput()->returnToMain( true, $title );
}
diff --git a/includes/specials/SpecialEmailInvalidate.php b/includes/specials/SpecialEmailInvalidate.php
index ef217311522..d0077568f33 100644
--- a/includes/specials/SpecialEmailInvalidate.php
+++ b/includes/specials/SpecialEmailInvalidate.php
@@ -83,7 +83,7 @@ class SpecialEmailInvalidate extends UnlistedSpecialPage {
$user->saveSettings();
$this->getOutput()->addWikiMsg( 'confirmemail_invalidated' );
- if ( !$this->getUser()->isLoggedIn() ) {
+ if ( !$this->getUser()->isRegistered() ) {
$this->getOutput()->returnToMain();
}
}
diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php
index 46e9b6da161..3601e785d51 100644
--- a/includes/specials/SpecialMovepage.php
+++ b/includes/specials/SpecialMovepage.php
@@ -196,7 +196,7 @@ class MovePageForm extends UnlistedSpecialPage {
$this->moveSubpages = $request->getBool( 'wpMovesubpages' );
$this->deleteAndMove = $request->getBool( 'wpDeleteAndMove' );
$this->moveOverShared = $request->getBool( 'wpMoveOverSharedFile' );
- $this->watch = $request->getCheck( 'wpWatch' ) && $user->isLoggedIn();
+ $this->watch = $request->getCheck( 'wpWatch' ) && $user->isRegistered();
if ( $request->getVal( 'action' ) == 'submit' && $request->wasPosted()
&& $user->matchEditToken( $request->getVal( 'wpEditToken' ) )
@@ -521,7 +521,7 @@ class MovePageForm extends UnlistedSpecialPage {
}
# Don't allow watching if user is not logged in
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$watchChecked = ( $this->watch || $this->userOptionsLookup->getBoolOption( $user, 'watchmoves' )
|| $user->isWatched( $this->oldTitle ) );
$fields[] = new OOUI\FieldLayout(
diff --git a/includes/specials/SpecialPasswordReset.php b/includes/specials/SpecialPasswordReset.php
index 70914bcd620..434a881a585 100644
--- a/includes/specials/SpecialPasswordReset.php
+++ b/includes/specials/SpecialPasswordReset.php
@@ -89,7 +89,7 @@ class SpecialPasswordReset extends FormSpecialPage {
'label-message' => 'passwordreset-username',
];
- if ( $this->getUser()->isLoggedIn() ) {
+ if ( $this->getUser()->isRegistered() ) {
$a['Username']['default'] = $this->getUser()->getName();
}
}
diff --git a/includes/specials/SpecialRecentChanges.php b/includes/specials/SpecialRecentChanges.php
index defc1e9c7d2..2eed6e08048 100644
--- a/includes/specials/SpecialRecentChanges.php
+++ b/includes/specials/SpecialRecentChanges.php
@@ -229,7 +229,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
*/
private function needsWatchlistFeatures(): bool {
return !$this->including()
- && $this->getUser()->isLoggedIn()
+ && $this->getUser()->isRegistered()
&& $this->permissionManager->userHasRight( $this->getUser(), 'viewmywatchlist' );
}
diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php
index b16ec9d1f81..01eb4961dd7 100644
--- a/includes/specials/SpecialSearch.php
+++ b/includes/specials/SpecialSearch.php
@@ -752,7 +752,7 @@ class SpecialSearch extends SpecialPage {
$user = $this->getUser();
$request = $this->getRequest();
- if ( $user->isLoggedIn() &&
+ if ( $user->isRegistered() &&
$user->matchEditToken(
$request->getVal( 'nsRemember' ),
'searchnamespace',
diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php
index c0c1e88cfeb..9d0582a4342 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -139,7 +139,7 @@ class SpecialUpload extends SpecialPage {
$this->mDestWarningAck = $request->getText( 'wpDestFileWarningAck' );
$this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' )
|| $request->getCheck( 'wpUploadIgnoreWarning' );
- $this->mWatchthis = $request->getBool( 'wpWatchthis' ) && $this->getUser()->isLoggedIn();
+ $this->mWatchthis = $request->getBool( 'wpWatchthis' ) && $this->getUser()->isRegistered();
$this->mCopyrightStatus = $request->getText( 'wpUploadCopyStatus' );
$this->mCopyrightSource = $request->getText( 'wpUploadSource' );
diff --git a/includes/specials/SpecialUserLogin.php b/includes/specials/SpecialUserLogin.php
index deab1a10ea7..1f210293791 100644
--- a/includes/specials/SpecialUserLogin.php
+++ b/includes/specials/SpecialUserLogin.php
@@ -68,7 +68,7 @@ class SpecialUserLogin extends LoginSignupSpecialPage {
public function setHeaders() {
// override the page title if we are doing a forced reauthentication
parent::setHeaders();
- if ( $this->securityLevel && $this->getUser()->isLoggedIn() ) {
+ if ( $this->securityLevel && $this->getUser()->isRegistered() ) {
$this->getOutput()->setPageTitle( $this->msg( 'login-security' ) );
}
}
diff --git a/includes/specials/forms/UploadForm.php b/includes/specials/forms/UploadForm.php
index b20fa0efe1a..7f1185a9b52 100644
--- a/includes/specials/forms/UploadForm.php
+++ b/includes/specials/forms/UploadForm.php
@@ -398,7 +398,7 @@ class UploadForm extends HTMLForm {
*/
protected function getOptionsSection() {
$user = $this->getUser();
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$descriptor = [
'Watchthis' => [
'type' => 'check',
diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php
index 309bba3f0c0..7337838e915 100644
--- a/includes/upload/UploadStash.php
+++ b/includes/upload/UploadStash.php
@@ -73,7 +73,7 @@ class UploadStash {
protected $fileProps = [];
// current user
- protected $user, $userId, $isLoggedIn;
+ protected $user, $userId, $isRegistered;
/**
* Represents a temporary filestore, with metadata in the database.
@@ -96,7 +96,7 @@ class UploadStash {
if ( is_object( $this->user ) ) {
$this->userId = $this->user->getId();
- $this->isLoggedIn = $this->user->isLoggedIn();
+ $this->isRegistered = $this->user->isRegistered();
}
}
@@ -120,7 +120,7 @@ class UploadStash {
);
}
- if ( !$noAuth && !$this->isLoggedIn ) {
+ if ( !$noAuth && !$this->isRegistered ) {
throw new UploadStashNotLoggedInException(
wfMessage( 'uploadstash-not-logged-in' )
);
@@ -277,7 +277,7 @@ class UploadStash {
$stashPath = $storeStatus->value;
// fetch the current user ID
- if ( !$this->isLoggedIn ) {
+ if ( !$this->isRegistered ) {
throw new UploadStashNotLoggedInException(
wfMessage( 'uploadstash-not-logged-in' )
);
@@ -338,7 +338,7 @@ class UploadStash {
* @return bool Success
*/
public function clear() {
- if ( !$this->isLoggedIn ) {
+ if ( !$this->isRegistered ) {
throw new UploadStashNotLoggedInException(
wfMessage( 'uploadstash-not-logged-in' )
);
@@ -368,7 +368,7 @@ class UploadStash {
* @return bool Success
*/
public function removeFile( $key ) {
- if ( !$this->isLoggedIn ) {
+ if ( !$this->isRegistered ) {
throw new UploadStashNotLoggedInException(
wfMessage( 'uploadstash-not-logged-in' )
);
@@ -438,7 +438,7 @@ class UploadStash {
* @return array|false
*/
public function listFiles() {
- if ( !$this->isLoggedIn ) {
+ if ( !$this->isRegistered ) {
throw new UploadStashNotLoggedInException(
wfMessage( 'uploadstash-not-logged-in' )
);
diff --git a/includes/user/User.php b/includes/user/User.php
index 7b930ea58f8..deba5779719 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -1228,7 +1228,7 @@ class User implements IDBAccessObject, UserIdentity {
// returned here, so just use it if applicable.
$session = $this->getRequest()->getSession();
$user = $session->getUser();
- if ( $user->isLoggedIn() ) {
+ if ( $user->isRegistered() ) {
$this->loadFromUserObject( $user );
// Other code expects these to be set in the session, so set them.
@@ -2961,8 +2961,7 @@ class User implements IDBAccessObject, UserIdentity {
}
/**
- * Alias of isLoggedIn() with a name that describes its actual functionality. UserIdentity has
- * only this new name and not the old isLoggedIn() variant.
+ * Get whether the user is registered.
*
* @return bool True if user is registered on this wiki, i.e., has a user ID. False if user is
* anonymous or has no local account (which can happen when importing). This is equivalent to
@@ -3527,7 +3526,7 @@ class User implements IDBAccessObject, UserIdentity {
* in code along the lines of:
*
* $user = User::newFromName( $name );
- * if ( !$user->isLoggedIn() ) {
+ * if ( !$user->isRegistered() ) {
* $user->addToDatabase();
* }
* // do something with $user...
@@ -3537,7 +3536,7 @@ class User implements IDBAccessObject, UserIdentity {
* calling sequence as far as possible.
*
* Note that if the user exists, this function will acquire a write lock,
- * so it is still advisable to make the call conditional on isLoggedIn(),
+ * so it is still advisable to make the call conditional on isRegistered(),
* and to commit the transaction after calling.
*
* @throws MWException
@@ -3628,7 +3627,7 @@ class User implements IDBAccessObject, UserIdentity {
* @return bool A block was spread
*/
public function spreadAnyEditBlock() {
- if ( $this->isLoggedIn() && $this->getBlock() ) {
+ if ( $this->isRegistered() && $this->getBlock() ) {
return $this->spreadBlock();
}
diff --git a/maintenance/uppercaseTitlesForUnicodeTransition.php b/maintenance/uppercaseTitlesForUnicodeTransition.php
index 4ec3faa94c2..f67d5de411b 100644
--- a/maintenance/uppercaseTitlesForUnicodeTransition.php
+++ b/maintenance/uppercaseTitlesForUnicodeTransition.php
@@ -116,7 +116,7 @@ class UppercaseTitlesForUnicodeTransition extends Maintenance {
$this->user = User::newSystemUser( $username, [ 'steal' => $steal ] );
if ( !$this->user ) {
$user = User::newFromName( $username );
- if ( !$steal && $user && $user->isLoggedIn() ) {
+ if ( !$steal && $user && $user->isRegistered() ) {
$this->fatalError( "User $username already exists.\n"
. "Use --steal if you really want to steal it from the human who currently owns it."
);
diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php
index 226cb863f10..5d0f0592061 100644
--- a/tests/phpunit/includes/EditPageTest.php
+++ b/tests/phpunit/includes/EditPageTest.php
@@ -914,7 +914,7 @@ hello
$this->setMwGlobals( 'wgWatchlistExpiry', true );
MWTimestamp::setFakeTime( '20200505120000' );
$user = $this->getTestUser()->getUser();
- $this->assertTrue( $user->isLoggedIn() );
+ $this->assertTrue( $user->isRegistered() );
// Create the EditPage.
$title = Title::newFromText( __METHOD__ );
diff --git a/tests/phpunit/includes/TestUser.php b/tests/phpunit/includes/TestUser.php
index d8dbafc3f94..c695ab8dfd7 100644
--- a/tests/phpunit/includes/TestUser.php
+++ b/tests/phpunit/includes/TestUser.php
@@ -44,7 +44,7 @@ class TestUser {
// But for now, we just need to create or update the user with the desired properties.
// we particularly need the new password, since we just generated it randomly.
// In core MediaWiki, there is no functionality to delete users, so this is the best we can do.
- if ( !$this->user->isLoggedIn() ) {
+ if ( !$this->user->isRegistered() ) {
// create the user
$this->user = User::createNew(
$this->username, [
diff --git a/tests/phpunit/includes/TestUserRegistry.php b/tests/phpunit/includes/TestUserRegistry.php
index d48fc092f89..f28fd614528 100644
--- a/tests/phpunit/includes/TestUserRegistry.php
+++ b/tests/phpunit/includes/TestUserRegistry.php
@@ -64,7 +64,7 @@ class TestUserRegistry {
$testUser = self::$testUsers[$key] ?? false;
- if ( !$testUser || !$testUser->getUser()->isLoggedIn() ) {
+ if ( !$testUser || !$testUser->getUser()->isRegistered() ) {
$id = self::getNextId();
// Hack! If this is the primary sysop account, make the username
// be 'UTSysop', for back-compat, and for the sake of PHPUnit data
diff --git a/tests/phpunit/includes/actions/WatchActionTest.php b/tests/phpunit/includes/actions/WatchActionTest.php
index dcf1525d902..76ed8375760 100644
--- a/tests/phpunit/includes/actions/WatchActionTest.php
+++ b/tests/phpunit/includes/actions/WatchActionTest.php
@@ -97,7 +97,7 @@ class WatchActionTest extends MediaWikiIntegrationTestCase {
->setConstructorArgs( [ $this->watchAction->getContext() ] )
->getMock();
- // Change the context to have a logged in user with correct permission.
+ // Change the context to have a registered user with correct permission.
$testContext->setUser( $this->getUser( true, true, [ 'editmywatchlist' ] ) );
/** @var MockObject|WebRequest $testRequest */
@@ -143,10 +143,10 @@ class WatchActionTest extends MediaWikiIntegrationTestCase {
* @covers WatchAction::checkCanExecute()
*/
public function testShowUserLoggedInNoException() {
- $loggedInUser = $this->createMock( User::class );
- $loggedInUser->method( 'isLoggedIn' )->willReturn( true );
+ $registeredUser = $this->createMock( User::class );
+ $registeredUser->method( 'isRegistered' )->willReturn( true );
$testContext = new DerivativeContext( $this->watchAction->getContext() );
- $testContext->setUser( $loggedInUser );
+ $testContext->setUser( $registeredUser );
$watchAction = new WatchAction(
Article::newFromWikiPage( $this->testWikiPage, $testContext ),
$testContext
@@ -159,7 +159,7 @@ class WatchActionTest extends MediaWikiIntegrationTestCase {
$exception = $e;
}
$this->assertNull( $exception,
- 'UserNotLoggedIn exception should not be thrown if user is logged in.' );
+ 'UserNotLoggedIn exception should not be thrown if user is a registered one.' );
}
/**
@@ -653,7 +653,7 @@ class WatchActionTest extends MediaWikiIntegrationTestCase {
}
/**
- * @param bool $isLoggedIn Whether the user should be "marked" as logged in
+ * @param bool $isRegistered Whether the user should be "marked" as registered
* @param bool|string $isWatched The value any call to isWatched should return.
* A string value is the expiry that should be used.
* @param array $permissions The permissions of the user
@@ -661,13 +661,13 @@ class WatchActionTest extends MediaWikiIntegrationTestCase {
* @throws Exception
*/
private function getUser(
- $isLoggedIn = true,
+ $isRegistered = true,
$isWatched = true,
$permissions = []
) {
$user = $this->createMock( User::class );
$user->method( 'getId' )->willReturn( 42 );
- $user->method( 'isLoggedIn' )->willReturn( $isLoggedIn );
+ $user->method( 'isRegistered' )->willReturn( $isRegistered );
$user->method( 'isWatched' )->willReturn( $isWatched );
// Override WatchedItemStore to think the page is watched, if applicable.
diff --git a/tests/phpunit/includes/api/ApiLogoutTest.php b/tests/phpunit/includes/api/ApiLogoutTest.php
index 16df3b04273..066cbc478a0 100644
--- a/tests/phpunit/includes/api/ApiLogoutTest.php
+++ b/tests/phpunit/includes/api/ApiLogoutTest.php
@@ -27,30 +27,30 @@ class ApiLogoutTest extends ApiTestCase {
$token = 'invalid token';
$this->doUserLogout( $token, $user );
} finally {
- $this->assertTrue( $user->isLoggedIn(), 'not logged out' );
+ $this->assertTrue( $user->isRegistered(), 'not logged out' );
}
}
public function testUserLogout() {
$user = $this->getTestSysop()->getUser();
- $this->assertTrue( $user->isLoggedIn(), 'sanity check' );
+ $this->assertTrue( $user->isRegistered(), 'sanity check' );
$token = $this->getUserCsrfTokenFromApi( $user );
$this->doUserLogout( $token, $user );
- $this->assertFalse( $user->isLoggedIn() );
+ $this->assertFalse( $user->isRegistered() );
}
public function testUserLogoutWithWebToken() {
global $wgRequest;
$user = $this->getTestSysop()->getUser();
- $this->assertTrue( $user->isLoggedIn(), 'sanity check' );
+ $this->assertTrue( $user->isRegistered(), 'sanity check' );
// Logic copied from SkinTemplate.
$token = $user->getEditToken( 'logoutToken', $wgRequest );
$this->doUserLogout( $token, $user );
- $this->assertFalse( $user->isLoggedIn() );
+ $this->assertFalse( $user->isRegistered() );
}
private function getUserCsrfTokenFromApi( User $user ) {
diff --git a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
index b4f4261cc05..93d1d7fbe14 100644
--- a/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
+++ b/tests/phpunit/includes/auth/TemporaryPasswordPrimaryAuthenticationProviderTest.php
@@ -217,31 +217,31 @@ class TemporaryPasswordPrimaryAuthenticationProviderTest extends \MediaWikiInteg
public static function provideGetAuthenticationRequests() {
$anon = [ 'username' => null ];
- $loggedIn = [ 'username' => 'UTSysop' ];
+ $registered = [ 'username' => 'UTSysop' ];
return [
[ AuthManager::ACTION_LOGIN, $anon, [
new PasswordAuthenticationRequest
] ],
- [ AuthManager::ACTION_LOGIN, $loggedIn, [
+ [ AuthManager::ACTION_LOGIN, $registered, [
new PasswordAuthenticationRequest
] ],
[ AuthManager::ACTION_CREATE, $anon, [] ],
- [ AuthManager::ACTION_CREATE, $loggedIn, [
+ [ AuthManager::ACTION_CREATE, $registered, [
new TemporaryPasswordAuthenticationRequest( 'random' )
] ],
[ AuthManager::ACTION_LINK, $anon, [] ],
- [ AuthManager::ACTION_LINK, $loggedIn, [] ],
+ [ AuthManager::ACTION_LINK, $registered, [] ],
[ AuthManager::ACTION_CHANGE, $anon, [
new TemporaryPasswordAuthenticationRequest( 'random' )
] ],
- [ AuthManager::ACTION_CHANGE, $loggedIn, [
+ [ AuthManager::ACTION_CHANGE, $registered, [
new TemporaryPasswordAuthenticationRequest( 'random' )
] ],
[ AuthManager::ACTION_REMOVE, $anon, [
new TemporaryPasswordAuthenticationRequest
] ],
- [ AuthManager::ACTION_REMOVE, $loggedIn, [
+ [ AuthManager::ACTION_REMOVE, $registered, [
new TemporaryPasswordAuthenticationRequest
] ],
];
diff --git a/tests/phpunit/includes/block/BlockManagerTest.php b/tests/phpunit/includes/block/BlockManagerTest.php
index ee03d74a453..62125ee0abe 100644
--- a/tests/phpunit/includes/block/BlockManagerTest.php
+++ b/tests/phpunit/includes/block/BlockManagerTest.php
@@ -84,7 +84,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase {
], $options['blockOptions'] ) );
$blockStore->insertBlock( $block );
- $user = $options['loggedIn'] ? $this->user : new User();
+ $user = $options['registered'] ? $this->user : new User();
$user->getRequest()->setCookie( 'BlockID', $blockManager->getCookieValue( $block ) );
$this->assertSame( $expected, (bool)$blockManager->getBlockFromCookieValue(
@@ -115,7 +115,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase {
], $options['blockOptions'] ) );
$blockStore->insertBlock( $block );
- $user = $options['loggedIn'] ? $this->user : new User();
+ $user = $options['registered'] ? $this->user : new User();
$user->getRequest()->setCookie( 'BlockID', $blockManager->getCookieValue( $block ) );
$response = new FauxResponse;
@@ -138,7 +138,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase {
'Autoblocking user block' => [
[
'target' => '',
- 'loggedIn' => true,
+ 'registered' => true,
'blockOptions' => [
'enableAutoblock' => true
],
@@ -148,7 +148,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase {
'Autoblocking user block for anonymous user' => [
[
'target' => '',
- 'loggedIn' => false,
+ 'registered' => false,
'blockOptions' => [
'enableAutoblock' => true
],
@@ -158,7 +158,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase {
'Non-autoblocking user block' => [
[
'target' => '',
- 'loggedIn' => true,
+ 'registered' => true,
'blockOptions' => [],
],
false,
@@ -166,7 +166,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase {
'IP block for anonymous user' => [
[
'target' => '127.0.0.1',
- 'loggedIn' => false,
+ 'registered' => false,
'blockOptions' => [],
],
true,
@@ -174,7 +174,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase {
'IP block for logged in user' => [
[
'target' => '127.0.0.1',
- 'loggedIn' => true,
+ 'registered' => true,
'blockOptions' => [],
],
false,
@@ -182,7 +182,7 @@ class BlockManagerTest extends MediaWikiIntegrationTestCase {
'IP range block for anonymous user' => [
[
'target' => '127.0.0.0/8',
- 'loggedIn' => false,
+ 'registered' => false,
'blockOptions' => [],
],
true,
diff --git a/tests/phpunit/includes/context/RequestContextTest.php b/tests/phpunit/includes/context/RequestContextTest.php
index 143099f9db9..405a9719714 100644
--- a/tests/phpunit/includes/context/RequestContextTest.php
+++ b/tests/phpunit/includes/context/RequestContextTest.php
@@ -95,7 +95,7 @@ class RequestContextTest extends MediaWikiIntegrationTestCase {
} else {
$this->assertEquals( $oldSessionId, session_id(), "Unchanged PHP session ID." );
}
- $this->assertTrue( $context->getUser()->isLoggedIn(), "Correct context user." );
+ $this->assertTrue( $context->getUser()->isRegistered(), "Correct context user." );
$this->assertEquals( $sinfo['userId'], $context->getUser()->getId(), "Correct context user ID." );
$this->assertEquals(
'UnitTestContextUser',
diff --git a/tests/phpunit/includes/user/UserTest.php b/tests/phpunit/includes/user/UserTest.php
index a4a8f8e3119..7f8ffa40c57 100644
--- a/tests/phpunit/includes/user/UserTest.php
+++ b/tests/phpunit/includes/user/UserTest.php
@@ -728,31 +728,31 @@ class UserTest extends MediaWikiIntegrationTestCase {
* @covers User::isAnon
* @covers User::logOut
*/
- public function testLoggedIn() {
+ public function testIsRegistered() {
$user = $this->getMutableTestUser()->getUser();
$this->assertTrue( $user->isRegistered() );
- $this->assertTrue( $user->isLoggedIn() );
+ $this->assertTrue( $user->isLoggedIn() ); // Deprecated wrapper method
$this->assertFalse( $user->isAnon() );
$this->setTemporaryHook( 'UserLogout', function ( &$user ) {
return false;
} );
$user->logout();
- $this->assertTrue( $user->isLoggedIn() );
+ $this->assertTrue( $user->isRegistered() );
$this->removeTemporaryHook( 'UserLogout' );
$user->logout();
- $this->assertFalse( $user->isLoggedIn() );
+ $this->assertFalse( $user->isRegistered() );
// Non-existent users are perceived as anonymous
$user = User::newFromName( 'UTNonexistent' );
$this->assertFalse( $user->isRegistered() );
- $this->assertFalse( $user->isLoggedIn() );
+ $this->assertFalse( $user->isLoggedIn() ); // Deprecated wrapper method
$this->assertTrue( $user->isAnon() );
$user = new User;
$this->assertFalse( $user->isRegistered() );
- $this->assertFalse( $user->isLoggedIn() );
+ $this->assertFalse( $user->isLoggedIn() ); // Deprecated wrapper method
$this->assertTrue( $user->isAnon() );
}
@@ -789,7 +789,7 @@ class UserTest extends MediaWikiIntegrationTestCase {
public function testCheckAndSetTouched() {
$user = $this->getMutableTestUser()->getUser();
$user = TestingAccessWrapper::newFromObject( $user );
- $this->assertTrue( $user->isLoggedIn() );
+ $this->assertTrue( $user->isRegistered() );
$touched = $user->getDBTouched();
$this->assertTrue(