dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Update magic words and special page aliases for Arabic and Egyptian Arabic"
[lhc/web/wiklou.git]
/
includes
/
user
/
User.php
diff --git
a/includes/user/User.php
b/includes/user/User.php
index
bb1e751
..
4d16594
100644
(file)
--- a/
includes/user/User.php
+++ b/
includes/user/User.php
@@
-522,7
+522,6
@@
class User implements IDBAccessObject {
}
return $data;
}
return $data;
-
},
[ 'pcTTL' => $cache::TTL_PROC_LONG, 'version' => self::VERSION ]
);
},
[ 'pcTTL' => $cache::TTL_PROC_LONG, 'version' => self::VERSION ]
);
@@
-694,19
+693,31
@@
class User implements IDBAccessObject {
return null;
}
return null;
}
- $fields = self::selectFields();
-
- $dbw = wfGetDB( DB_MASTER );
- $row = $dbw->selectRow(
+ $dbr = wfGetDB( DB_REPLICA );
+ $row = $dbr->selectRow(
'user',
'user',
-
$fields
,
+
self::selectFields()
,
[ 'user_name' => $name ],
__METHOD__
);
[ 'user_name' => $name ],
__METHOD__
);
+ if ( !$row ) {
+ // Try the master database...
+ $dbw = wfGetDB( DB_MASTER );
+ $row = $dbw->selectRow(
+ 'user',
+ self::selectFields(),
+ [ 'user_name' => $name ],
+ __METHOD__
+ );
+ }
+
if ( !$row ) {
// No user. Create it?
if ( !$row ) {
// No user. Create it?
- return $options['create'] ? self::createNew( $name, [ 'token' => self::INVALID_TOKEN ] ) : null;
+ return $options['create']
+ ? self::createNew( $name, [ 'token' => self::INVALID_TOKEN ] )
+ : null;
}
}
+
$user = self::newFromRow( $row );
// A user is considered to exist as a non-system user if it can
$user = self::newFromRow( $row );
// A user is considered to exist as a non-system user if it can
@@
-1942,11
+1953,12
@@
class User implements IDBAccessObject {
$id = $this->getId();
$userLimit = false;
$isNewbie = $this->isNewbie();
$id = $this->getId();
$userLimit = false;
$isNewbie = $this->isNewbie();
+ $cache = ObjectCache::getLocalClusterInstance();
if ( $id == 0 ) {
// limits for anons
if ( isset( $limits['anon'] ) ) {
if ( $id == 0 ) {
// limits for anons
if ( isset( $limits['anon'] ) ) {
- $keys[
wfMemc
Key( 'limiter', $action, 'anon' )] = $limits['anon'];
+ $keys[
$cache->make
Key( 'limiter', $action, 'anon' )] = $limits['anon'];
}
} else {
// limits for logged-in users
}
} else {
// limits for logged-in users
@@
-1955,7
+1967,7
@@
class User implements IDBAccessObject {
}
// limits for newbie logged-in users
if ( $isNewbie && isset( $limits['newbie'] ) ) {
}
// limits for newbie logged-in users
if ( $isNewbie && isset( $limits['newbie'] ) ) {
- $keys[
wfMemc
Key( 'limiter', $action, 'user', $id )] = $limits['newbie'];
+ $keys[
$cache->make
Key( 'limiter', $action, 'user', $id )] = $limits['newbie'];
}
}
}
}
@@
-1992,7
+2004,7
@@
class User implements IDBAccessObject {
if ( $userLimit !== false ) {
list( $max, $period ) = $userLimit;
wfDebug( __METHOD__ . ": effective user limit: $max in {$period}s\n" );
if ( $userLimit !== false ) {
list( $max, $period ) = $userLimit;
wfDebug( __METHOD__ . ": effective user limit: $max in {$period}s\n" );
- $keys[
wfMemc
Key( 'limiter', $action, 'user', $id )] = $userLimit;
+ $keys[
$cache->make
Key( 'limiter', $action, 'user', $id )] = $userLimit;
}
// ip-based limits for all ping-limitable users
}
// ip-based limits for all ping-limitable users
@@
-2019,8
+2031,6
@@
class User implements IDBAccessObject {
}
}
}
}
- $cache = ObjectCache::getLocalClusterInstance();
-
$triggered = false;
foreach ( $keys as $key => $limit ) {
list( $max, $period ) = $limit;
$triggered = false;
foreach ( $keys as $key => $limit ) {
list( $max, $period ) = $limit;
@@
-2529,8
+2539,9
@@
class User implements IDBAccessObject {
public function touch() {
$id = $this->getId();
if ( $id ) {
public function touch() {
$id = $this->getId();
if ( $id ) {
- $key = wfMemcKey( 'user-quicktouched', 'id', $id );
- ObjectCache::getMainWANInstance()->touchCheckKey( $key );
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ $key = $cache->makeKey( 'user-quicktouched', 'id', $id );
+ $cache->touchCheckKey( $key );
$this->mQuickTouched = null;
}
}
$this->mQuickTouched = null;
}
}
@@
-2557,8
+2568,8
@@
class User implements IDBAccessObject {
if ( $this->mId ) {
if ( $this->mQuickTouched === null ) {
if ( $this->mId ) {
if ( $this->mQuickTouched === null ) {
- $
key = wfMemcKey( 'user-quicktouched', 'id', $this->mId
);
- $
cache = ObjectCache::getMainWANInstance(
);
+ $
cache = MediaWikiServices::getInstance()->getMainWANObjectCache(
);
+ $
key = $cache->makeKey( 'user-quicktouched', 'id', $this->mId
);
$this->mQuickTouched = wfTimestamp( TS_MW, $cache->getCheckKeyTime( $key ) );
}
$this->mQuickTouched = wfTimestamp( TS_MW, $cache->getCheckKeyTime( $key ) );
}
@@
-4171,6
+4182,10
@@
class User implements IDBAccessObject {
$this->setToken(); // init token
}
$this->setToken(); // init token
}
+ if ( !is_string( $this->mName ) ) {
+ throw new RuntimeException( "User name field is not set." );
+ }
+
$this->mTouched = $this->newTouchedTimestamp();
$noPass = PasswordFactory::newInvalidPassword()->toString();
$this->mTouched = $this->newTouchedTimestamp();
$noPass = PasswordFactory::newInvalidPassword()->toString();