2020-10-24 11:58:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\AbuseFilter;
|
|
|
|
|
|
|
|
use AbuseFilterVariableHolder;
|
|
|
|
use MediaWiki\Config\ServiceOptions;
|
|
|
|
use Title;
|
|
|
|
use User;
|
|
|
|
use Wikimedia\Rdbms\ILoadBalancer;
|
|
|
|
|
|
|
|
class AbuseLoggerFactory {
|
|
|
|
public const SERVICE_NAME = 'AbuseFilterAbuseLoggerFactory';
|
|
|
|
|
|
|
|
/** @var CentralDBManager */
|
|
|
|
private $centralDBManager;
|
|
|
|
/** @var FilterLookup */
|
|
|
|
private $filterLookup;
|
2020-09-29 14:52:05 +00:00
|
|
|
/** @var VariablesBlobStore */
|
|
|
|
private $varBlobStore;
|
2020-10-18 22:25:05 +00:00
|
|
|
/** @var VariablesManager */
|
|
|
|
private $varManager;
|
2020-10-24 11:58:46 +00:00
|
|
|
/** @var ILoadBalancer */
|
|
|
|
private $loadBalancer;
|
|
|
|
/** @var ServiceOptions */
|
|
|
|
private $options;
|
|
|
|
/** @var string */
|
|
|
|
private $wikiID;
|
|
|
|
/** @var string */
|
|
|
|
private $requestIP;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param CentralDBManager $centralDBManager
|
|
|
|
* @param FilterLookup $filterLookup
|
2020-09-29 14:52:05 +00:00
|
|
|
* @param VariablesBlobStore $varBlobStore
|
2020-10-18 22:25:05 +00:00
|
|
|
* @param VariablesManager $varManager
|
2020-10-24 11:58:46 +00:00
|
|
|
* @param ILoadBalancer $loadBalancer
|
|
|
|
* @param ServiceOptions $options
|
|
|
|
* @param string $wikiID
|
|
|
|
* @param string $requestIP
|
|
|
|
*/
|
|
|
|
public function __construct(
|
|
|
|
CentralDBManager $centralDBManager,
|
|
|
|
FilterLookup $filterLookup,
|
2020-09-29 14:52:05 +00:00
|
|
|
VariablesBlobStore $varBlobStore,
|
2020-10-18 22:25:05 +00:00
|
|
|
VariablesManager $varManager,
|
2020-10-24 11:58:46 +00:00
|
|
|
ILoadBalancer $loadBalancer,
|
|
|
|
ServiceOptions $options,
|
|
|
|
string $wikiID,
|
|
|
|
string $requestIP
|
|
|
|
) {
|
|
|
|
$this->centralDBManager = $centralDBManager;
|
|
|
|
$this->filterLookup = $filterLookup;
|
2020-09-29 14:52:05 +00:00
|
|
|
$this->varBlobStore = $varBlobStore;
|
2020-10-18 22:25:05 +00:00
|
|
|
$this->varManager = $varManager;
|
2020-10-24 11:58:46 +00:00
|
|
|
$this->loadBalancer = $loadBalancer;
|
|
|
|
$this->options = $options;
|
|
|
|
$this->wikiID = $wikiID;
|
|
|
|
$this->requestIP = $requestIP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Title $title
|
|
|
|
* @param User $user
|
|
|
|
* @param AbuseFilterVariableHolder $vars
|
|
|
|
* @return AbuseLogger
|
|
|
|
*/
|
|
|
|
public function newLogger(
|
|
|
|
Title $title,
|
|
|
|
User $user,
|
|
|
|
AbuseFilterVariableHolder $vars
|
|
|
|
) : AbuseLogger {
|
|
|
|
return new AbuseLogger(
|
|
|
|
$this->centralDBManager,
|
|
|
|
$this->filterLookup,
|
2020-09-29 14:52:05 +00:00
|
|
|
$this->varBlobStore,
|
2020-10-18 22:25:05 +00:00
|
|
|
$this->varManager,
|
2020-10-24 11:58:46 +00:00
|
|
|
$this->loadBalancer,
|
|
|
|
$this->options,
|
|
|
|
$this->wikiID,
|
|
|
|
$this->requestIP,
|
|
|
|
$title,
|
|
|
|
$user,
|
|
|
|
$vars
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|