jenkins-bot has submitted this change and it was merged. Change subject: Fixed local user cache purge in adminDelete()/adminUnattach() ......................................................................
Fixed local user cache purge in adminDelete()/adminUnattach() Change-Id: Ie1ffd645400396658227f2bb98a544119e0aa252 --- M includes/CentralAuthUser.php 1 file changed, 16 insertions(+), 5 deletions(-) Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/CentralAuthUser.php b/includes/CentralAuthUser.php old mode 100644 new mode 100755 index 5dd3c64..20c517c --- a/includes/CentralAuthUser.php +++ b/includes/CentralAuthUser.php @@ -1163,7 +1163,6 @@ * @return Status */ public function adminUnattach( $list ) { - global $wgMemc; if ( !count( $list ) ) { return Status::newFatal( 'centralauth-admin-none-selected' ); } @@ -1201,8 +1200,9 @@ 'user_password' => $password ), array( 'user_name' => $this->mName ), __METHOD__ ); + $id = $dblw->selectField( 'user', 'user_id', array( 'user_name' => $this->mName ), __METHOD__ ); - $wgMemc->delete( "$wikiName:user:id:$id" ); + $this->clearLocalUserCache( $wikiName, $id ); $lb->reuseConnection( $dblw ); @@ -1225,7 +1225,6 @@ * @return Status */ function adminDelete( $reason ) { - global $wgMemc; wfDebugLog( 'CentralAuth', "Deleting global account for user {$this->mName}" ); $centralDB = self::getCentralDB(); @@ -1245,8 +1244,11 @@ array( 'user_name' => $name ), __METHOD__ ); - $id = $localDB->selectField( 'user', 'user_id', array( 'user_name' => $this->mName ), __METHOD__ ); - $wgMemc->delete( "$wiki:user:id:$id" ); + + $id = $localDB->selectField( 'user', 'user_id', + array( 'user_name' => $this->mName ), __METHOD__ ); + $this->clearLocalUserCache( $wiki, $id ); + $lb->reuseConnection( $localDB ); } $wasSuppressed = $this->isOversighted(); @@ -2824,4 +2826,13 @@ $params ); } + + /** + * @param string $wiki + * @param integer $id + */ + private function clearLocalUserCache( $wiki, $id ) { + // @TODO: this has poor separation of concerns :/ + ObjectCache::getMainWANInstance()->delete( "$wiki:user:id:$id" ); + } } -- To view, visit https://gerrit.wikimedia.org/r/225012 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie1ffd645400396658227f2bb98a544119e0aa252 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/CentralAuth Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits