*/
const INVALID_TOKEN = '*** INVALID ***';
- /**
- * Global constant made accessible as class constants so that autoloader
- * magic can be used.
- * @deprecated since 1.27, use \MediaWiki\Session\Token::SUFFIX
- */
- const EDIT_TOKEN_SUFFIX = Token::SUFFIX;
-
/**
* @const int Serialized record version.
*/
if ( $s === false ) {
$result = null;
} else {
- $result = $s->user_id;
+ $result = (int)$s->user_id;
}
self::$idCacheByName[$name] = $result;
private function getBlockedStatus( $bFromReplica = true ) {
global $wgProxyWhitelist, $wgUser, $wgApplyIpBlocksToXff, $wgSoftBlockRanges;
- if ( -1 != $this->mBlockedby ) {
+ if ( $this->mBlockedby != -1 ) {
return;
}
$this->mActorId = (int)$dbw->insertId();
} else {
// Outdated cache?
- list( , $options ) = DBAccessObjectUtils::getDBOptions( $this->queryFlagsUsed );
- $this->mActorId = (int)$dbw->selectField( 'actor', 'actor_id', $q, __METHOD__, $options );
+ // Use LOCK IN SHARE MODE to bypass any MySQL REPEATABLE-READ snapshot.
+ $this->mActorId = (int)$dbw->selectField(
+ 'actor',
+ 'actor_id',
+ $q,
+ __METHOD__,
+ [ 'LOCK IN SHARE MODE' ]
+ );
if ( !$this->mActorId ) {
throw new CannotCreateActorException(
"Cannot create actor ID for user_id={$this->getId()} user_name={$this->getName()}"
*/
public function setCookies( $request = null, $secure = null, $rememberMe = false ) {
$this->load();
- if ( 0 == $this->mId ) {
+ if ( $this->mId == 0 ) {
return;
}
}
$this->load();
- if ( 0 == $this->mId ) {
+ if ( $this->mId == 0 ) {
return; // anon
}