jenkins-bot has submitted this change and it was merged.

Change subject: Revert "Revert "Conversion to using getMainStashInstance()""
......................................................................


Revert "Revert "Conversion to using getMainStashInstance()""

This reverts commit e4e78dcc4dce11edc86a82b2ca98c73b470660bb.

Change-Id: I9ec43428a5090eb940838c8580c73f049da0b833
---
M AbuseFilter.class.php
M AbuseFilter.hooks.php
M Views/AbuseFilterViewRevert.php
M api/ApiAbuseFilterUnblockAutopromote.php
4 files changed, 11 insertions(+), 13 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/AbuseFilter.class.php b/AbuseFilter.class.php
index b6b47b9..adeacd8 100755
--- a/AbuseFilter.class.php
+++ b/AbuseFilter.class.php
@@ -1307,10 +1307,12 @@
 
                                break;
                        case 'blockautopromote':
-                               global $wgUser, $wgMemc;
+                               global $wgUser;
                                if ( !$wgUser->isAnon() ) {
                                        $blockPeriod = (int)mt_rand( 3 * 86400, 
7 * 86400 ); // Block for 3-7 days.
-                                       $wgMemc->set( 
self::autoPromoteBlockKey( $wgUser ), true, $blockPeriod );
+                                       
ObjectCache::getMainStashInstance()->set(
+                                               self::autoPromoteBlockKey( 
$wgUser ), true, $blockPeriod
+                                       );
 
                                        $message = array(
                                                
'abusefilter-autopromote-blocked',
diff --git a/AbuseFilter.hooks.php b/AbuseFilter.hooks.php
old mode 100644
new mode 100755
index 892d901..faaafb3
--- a/AbuseFilter.hooks.php
+++ b/AbuseFilter.hooks.php
@@ -277,11 +277,8 @@
         * @return bool
         */
        public static function onGetAutoPromoteGroups( $user, &$promote ) {
-               global $wgMemc;
-
                $key = AbuseFilter::autoPromoteBlockKey( $user );
-
-               if ( $wgMemc->get( $key ) ) {
+               if ( ObjectCache::getMainStashInstance()->get( $key ) ) {
                        $promote = array();
                }
 
diff --git a/Views/AbuseFilterViewRevert.php b/Views/AbuseFilterViewRevert.php
old mode 100644
new mode 100755
index 941fa66..c1a7738
--- a/Views/AbuseFilterViewRevert.php
+++ b/Views/AbuseFilterViewRevert.php
@@ -209,9 +209,9 @@
                                );
                                return true;
                        case 'blockautopromote':
-                               global $wgMemc;
-                               $wgMemc->delete( 
AbuseFilter::autopromoteBlockKey(
-                                       User::newFromId( $result['userid'] ) ) 
);
+                               ObjectCache::getMainStashInstance()->delete(
+                                       AbuseFilter::autopromoteBlockKey( 
User::newFromId( $result['userid'] ) )
+                               );
                                return true;
                        case 'degroup':
                                // Pull the user's groups from the vars.
diff --git a/api/ApiAbuseFilterUnblockAutopromote.php 
b/api/ApiAbuseFilterUnblockAutopromote.php
old mode 100644
new mode 100755
index 73d1558..6b3cb17
--- a/api/ApiAbuseFilterUnblockAutopromote.php
+++ b/api/ApiAbuseFilterUnblockAutopromote.php
@@ -15,16 +15,15 @@
                        $this->dieUsage( $msg, 'notsuspended' );
                }
 
-               global $wgMemc;
                $key = AbuseFilter::autoPromoteBlockKey( $user );
-
-               if ( !$wgMemc->get( $key ) ) {
+               $stash = ObjectCache::getMainStashInstance();
+               if ( !$stash->get( $key ) ) {
                        // Same as above :(
                        $msg = wfMessage( 'abusefilter-reautoconfirm-none', 
$params['user'] )->text();
                        $this->dieUsage( $msg, 'notsuspended' );
                }
 
-               $wgMemc->delete( $key );
+               $stash->delete( $key );
 
                $res = array( 'user' => $params['user'] );
                $this->getResult()->addValue( null, $this->getModuleName(), 
$res );

-- 
To view, visit https://gerrit.wikimedia.org/r/227624
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9ec43428a5090eb940838c8580c73f049da0b833
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: wmf/1.26wmf15
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to