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
QA: Upgrade mediawiki_selenium to 1.2 for Raita logging
[lhc/web/wiklou.git]
/
includes
/
User.php
diff --git
a/includes/User.php
b/includes/User.php
index
c3d4a65
..
eb2a2dc
100644
(file)
--- a/
includes/User.php
+++ b/
includes/User.php
@@
-410,15
+410,14
@@
class User implements IDBAccessObject {
* @since 1.25
*/
protected function loadFromCache() {
* @since 1.25
*/
protected function loadFromCache() {
- global $wgMemc;
-
if ( $this->mId == 0 ) {
$this->loadDefaults();
return false;
}
if ( $this->mId == 0 ) {
$this->loadDefaults();
return false;
}
+ $cache = ObjectCache::getMainWANInstance();
$key = wfMemcKey( 'user', 'id', $this->mId );
$key = wfMemcKey( 'user', 'id', $this->mId );
- $data = $
wgMemc
->get( $key );
+ $data = $
cache
->get( $key );
if ( !is_array( $data ) || $data['mVersion'] < self::VERSION ) {
// Object is expired
return false;
if ( !is_array( $data ) || $data['mVersion'] < self::VERSION ) {
// Object is expired
return false;
@@
-440,8
+439,6
@@
class User implements IDBAccessObject {
* This method should not be called outside the User class
*/
public function saveToCache() {
* This method should not be called outside the User class
*/
public function saveToCache() {
- global $wgMemc;
-
$this->load();
$this->loadGroups();
$this->loadOptions();
$this->load();
$this->loadGroups();
$this->loadOptions();
@@
-451,6
+448,8
@@
class User implements IDBAccessObject {
return;
}
return;
}
+ $cache = ObjectCache::getMainWANInstance();
+
// The cache needs good consistency due to its high TTL, so the user
// should have been loaded from the master to avoid lag amplification.
if ( !( $this->queryFlagsUsed & self::READ_LATEST ) ) {
// The cache needs good consistency due to its high TTL, so the user
// should have been loaded from the master to avoid lag amplification.
if ( !( $this->queryFlagsUsed & self::READ_LATEST ) ) {
@@
-465,7
+464,7
@@
class User implements IDBAccessObject {
$data['mVersion'] = self::VERSION;
$key = wfMemcKey( 'user', 'id', $this->mId );
$data['mVersion'] = self::VERSION;
$key = wfMemcKey( 'user', 'id', $this->mId );
- $
wgMemc
->set( $key, $data );
+ $
cache
->set( $key, $data );
}
/** @name newFrom*() static factory methods */
}
/** @name newFrom*() static factory methods */
@@
-2252,8
+2251,6
@@
class User implements IDBAccessObject {
* page. Ignored if null or !$val.
*/
public function setNewtalk( $val, $curRev = null ) {
* page. Ignored if null or !$val.
*/
public function setNewtalk( $val, $curRev = null ) {
- global $wgMemc;
-
if ( wfReadOnly() ) {
return;
}
if ( wfReadOnly() ) {
return;
}
@@
-2275,12
+2272,6
@@
class User implements IDBAccessObject {
$changed = $this->deleteNewtalk( $field, $id );
}
$changed = $this->deleteNewtalk( $field, $id );
}
- if ( $this->isAnon() ) {
- // Anons have a separate memcached space, since
- // user records aren't kept for them.
- $key = wfMemcKey( 'newtalk', 'ip', $id );
- $wgMemc->set( $key, $val ? 1 : 0, 1800 );
- }
if ( $changed ) {
$this->invalidateCache();
}
if ( $changed ) {
$this->invalidateCache();
}
@@
-2310,11
+2301,10
@@
class User implements IDBAccessObject {
* Called implicitly from invalidateCache() and saveSettings().
*/
public function clearSharedCache() {
* Called implicitly from invalidateCache() and saveSettings().
*/
public function clearSharedCache() {
- global $wgMemc;
-
- $this->load();
- if ( $this->mId ) {
- $wgMemc->delete( wfMemcKey( 'user', 'id', $this->mId ) );
+ $id = $this->getId();
+ if ( $id ) {
+ $cache = ObjectCache::getMainWANInstance();
+ $cache->delete( wfMemcKey( 'user', 'id', $id ) );
}
}
}
}
@@
-2341,15
+2331,14
@@
class User implements IDBAccessObject {
* @since 1.25
*/
public function touch() {
* @since 1.25
*/
public function touch() {
- global $wgMemc;
-
$this->load();
if ( $this->mId ) {
$this->load();
if ( $this->mId ) {
+ $this->mQuickTouched = $this->newTouchedTimestamp();
+
+ $cache = ObjectCache::getMainWANInstance();
$key = wfMemcKey( 'user-quicktouched', 'id', $this->mId );
$key = wfMemcKey( 'user-quicktouched', 'id', $this->mId );
- $timestamp = $this->newTouchedTimestamp();
- $wgMemc->set( $key, $timestamp );
- $this->mQuickTouched = $timestamp;
+ $cache->touchCheckKey( $key );
}
}
}
}
@@
-2367,16
+2356,16
@@
class User implements IDBAccessObject {
* @return string TS_MW Timestamp
*/
public function getTouched() {
* @return string TS_MW Timestamp
*/
public function getTouched() {
- global $wgMemc;
-
$this->load();
if ( $this->mId ) {
if ( $this->mQuickTouched === null ) {
$this->load();
if ( $this->mId ) {
if ( $this->mQuickTouched === null ) {
+ $cache = ObjectCache::getMainWANInstance();
$key = wfMemcKey( 'user-quicktouched', 'id', $this->mId );
$key = wfMemcKey( 'user-quicktouched', 'id', $this->mId );
- $timestamp = $wgMemc->get( $key );
+
+ $timestamp = $cache->getCheckKeyTime( $key );
if ( $timestamp ) {
if ( $timestamp ) {
- $this->mQuickTouched =
$timestamp
;
+ $this->mQuickTouched =
wfTimestamp( TS_MW, $timestamp )
;
} else {
# Set the timestamp to get HTTP 304 cache hits
$this->touch();
} else {
# Set the timestamp to get HTTP 304 cache hits
$this->touch();
@@
-3455,7
+3444,9
@@
class User implements IDBAccessObject {
$force = 'force';
}
$force = 'force';
}
- $this->getWatchedItem( $title )->resetNotificationTimestamp( $force, $oldid );
+ $this->getWatchedItem( $title )->resetNotificationTimestamp(
+ $force, $oldid, WatchedItem::DEFERRED
+ );
}
/**
}
/**