mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SpamBlacklist
synced 2024-12-18 01:30:42 +00:00
Avoid usage of deprecated ObjectCache::getMainWANInstance()
Replacement with services made available in 1.28 and this extension requires 1.31. So, the replacement is good. Change-Id: I1960a36541c9578abc3178a3a5ddcac7c32b8292
This commit is contained in:
parent
3d81e121f1
commit
4d939a399a
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Base class for different kinds of blacklists
|
||||
*/
|
||||
|
@ -234,7 +236,7 @@ abstract class BaseBlacklist {
|
|||
public function getLocalBlacklists() {
|
||||
$that = $this;
|
||||
$type = $this->getBlacklistType();
|
||||
$cache = ObjectCache::getMainWANInstance();
|
||||
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
|
||||
|
||||
return $cache->getWithSetCallback(
|
||||
$cache->makeKey( 'spamblacklist', $type, 'blacklist-regex' ),
|
||||
|
@ -253,7 +255,7 @@ abstract class BaseBlacklist {
|
|||
public function getWhitelists() {
|
||||
$that = $this;
|
||||
$type = $this->getBlacklistType();
|
||||
$cache = ObjectCache::getMainWANInstance();
|
||||
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
|
||||
|
||||
return $cache->getWithSetCallback(
|
||||
$cache->makeKey( 'spamblacklist', $type, 'whitelist-regex' ),
|
||||
|
@ -282,7 +284,7 @@ abstract class BaseBlacklist {
|
|||
$miss = false;
|
||||
|
||||
$that = $this;
|
||||
$cache = ObjectCache::getMainWANInstance();
|
||||
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
|
||||
$regexes = $cache->getWithSetCallback(
|
||||
// This used to be cached per-site, but that could be bad on a shared
|
||||
// server where not all wikis have the same configuration.
|
||||
|
@ -307,7 +309,7 @@ abstract class BaseBlacklist {
|
|||
public function clearCache() {
|
||||
$listType = $this->getBlacklistType();
|
||||
|
||||
$cache = ObjectCache::getMainWANInstance();
|
||||
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
|
||||
$cache->delete( $cache->makeKey( 'spamblacklist', $listType, 'shared-blacklist-regex' ) );
|
||||
$cache->delete( $cache->makeKey( 'spamblacklist', $listType, 'blacklist-regex' ) );
|
||||
$cache->delete( $cache->makeKey( 'spamblacklist', $listType, 'whitelist-regex' ) );
|
||||
|
|
|
@ -271,7 +271,7 @@ class SpamBlacklist extends BaseBlacklist {
|
|||
* @return array
|
||||
*/
|
||||
public function getCurrentLinks( Title $title ) {
|
||||
$cache = ObjectCache::getMainWANInstance();
|
||||
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
|
||||
$fname = __METHOD__;
|
||||
return $cache->getWithSetCallback(
|
||||
// Key is warmed via warmCachesForFilter() from ApiStashEdit
|
||||
|
|
Loading…
Reference in a new issue