mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Conversion to using getMainStashInstance()
Bug: T97620 Change-Id: I7fc2c0a42bf295d71b9e0721ab4261290334cdec
This commit is contained in:
parent
86c3502c03
commit
9ffa400322
|
@ -1300,10 +1300,12 @@ class AbuseFilter {
|
|||
|
||||
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',
|
||||
|
|
5
AbuseFilter.hooks.php
Normal file → Executable file
5
AbuseFilter.hooks.php
Normal file → Executable file
|
@ -277,11 +277,8 @@ class AbuseFilterHooks {
|
|||
* @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();
|
||||
}
|
||||
|
||||
|
|
6
Views/AbuseFilterViewRevert.php
Normal file → Executable file
6
Views/AbuseFilterViewRevert.php
Normal file → Executable file
|
@ -209,9 +209,9 @@ class AbuseFilterViewRevert extends AbuseFilterView {
|
|||
);
|
||||
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.
|
||||
|
|
7
api/ApiAbuseFilterUnblockAutopromote.php
Normal file → Executable file
7
api/ApiAbuseFilterUnblockAutopromote.php
Normal file → Executable file
|
@ -15,16 +15,15 @@ class ApiAbuseFilterUnblockAutopromote extends ApiBase {
|
|||
$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 );
|
||||
|
|
Loading…
Reference in a new issue