summaryrefslogtreecommitdiff
path: root/includes/User.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:47 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:47 -0400
commit7e85254903c7c0cb49e381f16b18441ea7b058cc (patch)
treeb22328fcf4c8408fc25a7acb73d1cb1089cd82ac /includes/User.php
parent1de335ad3f395ca6861085393ba366a9e3fb4a0d (diff)
parent1a365e77dfb8825136626202b1df462731b42060 (diff)
Merge commit '1a365e'
Diffstat (limited to 'includes/User.php')
-rw-r--r--includes/User.php37
1 files changed, 7 insertions, 30 deletions
diff --git a/includes/User.php b/includes/User.php
index 3cd69fdc..8ea491ce 100644
--- a/includes/User.php
+++ b/includes/User.php
@@ -2204,6 +2204,8 @@ class User implements IDBAccessObject {
* page. Ignored if null or !$val.
*/
public function setNewtalk( $val, $curRev = null ) {
+ global $wgMemc;
+
if ( wfReadOnly() ) {
return;
}
@@ -2218,7 +2220,6 @@ class User implements IDBAccessObject {
$field = 'user_id';
$id = $this->getId();
}
- global $wgMemc;
if ( $val ) {
$changed = $this->updateNewtalk( $field, $id, $curRev );
@@ -2270,37 +2271,13 @@ class User implements IDBAccessObject {
}
/**
- * Immediately touch the user data cache for this account.
- * Updates user_touched field, and removes account data from memcached
- * for reload on the next hit.
+ * Immediately touch the user data cache for this account
+ *
+ * Calls touch() and removes account data from memcached
*/
public function invalidateCache() {
- if ( wfReadOnly() ) {
- return;
- }
- $this->load();
- if ( $this->mId ) {
- $this->mTouched = $this->newTouchedTimestamp();
-
- $dbw = wfGetDB( DB_MASTER );
- $userid = $this->mId;
- $touched = $this->mTouched;
- $method = __METHOD__;
- $dbw->onTransactionIdle( function () use ( $dbw, $userid, $touched, $method ) {
- // Prevent contention slams by checking user_touched first
- $encTouched = $dbw->addQuotes( $dbw->timestamp( $touched ) );
- $needsPurge = $dbw->selectField( 'user', '1',
- array( 'user_id' => $userid, 'user_touched < ' . $encTouched ) );
- if ( $needsPurge ) {
- $dbw->update( 'user',
- array( 'user_touched' => $dbw->timestamp( $touched ) ),
- array( 'user_id' => $userid, 'user_touched < ' . $encTouched ),
- $method
- );
- }
- } );
- $this->clearSharedCache();
- }
+ $this->touch();
+ $this->clearSharedCache();
}
/**