From 2f059883fbaa53570cd877bc010f9c224d4a7595 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Thu, 25 May 2017 00:48:09 -0700 Subject: [PATCH] User: Avoid deprecated wfMemcKey() Change-Id: Iffb4d85dfed740b01fcef5a25762dc751b292c41 --- includes/user/User.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/user/User.php b/includes/user/User.php index 3317a1bd03..131e419cd7 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -1941,11 +1941,12 @@ class User implements IDBAccessObject { $id = $this->getId(); $userLimit = false; $isNewbie = $this->isNewbie(); + $cache = ObjectCache::getLocalClusterInstance(); if ( $id == 0 ) { // limits for anons if ( isset( $limits['anon'] ) ) { - $keys[wfMemcKey( 'limiter', $action, 'anon' )] = $limits['anon']; + $keys[$cache->makeKey( 'limiter', $action, 'anon' )] = $limits['anon']; } } else { // limits for logged-in users @@ -1954,7 +1955,7 @@ class User implements IDBAccessObject { } // limits for newbie logged-in users if ( $isNewbie && isset( $limits['newbie'] ) ) { - $keys[wfMemcKey( 'limiter', $action, 'user', $id )] = $limits['newbie']; + $keys[$cache->makeKey( 'limiter', $action, 'user', $id )] = $limits['newbie']; } } @@ -1991,7 +1992,7 @@ class User implements IDBAccessObject { if ( $userLimit !== false ) { list( $max, $period ) = $userLimit; wfDebug( __METHOD__ . ": effective user limit: $max in {$period}s\n" ); - $keys[wfMemcKey( 'limiter', $action, 'user', $id )] = $userLimit; + $keys[$cache->makeKey( 'limiter', $action, 'user', $id )] = $userLimit; } // ip-based limits for all ping-limitable users @@ -2018,8 +2019,6 @@ class User implements IDBAccessObject { } } - $cache = ObjectCache::getLocalClusterInstance(); - $triggered = false; foreach ( $keys as $key => $limit ) { list( $max, $period ) = $limit; -- 2.20.1