2020-10-24 11:58:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\AbuseFilter;
|
|
|
|
|
|
|
|
use MediaWiki\Config\ServiceOptions;
|
2021-01-02 14:01:00 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariableHolder;
|
2021-01-02 13:41:31 +00:00
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariablesBlobStore;
|
|
|
|
use MediaWiki\Extension\AbuseFilter\Variables\VariablesManager;
|
2023-08-16 01:54:05 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2023-12-10 19:03:19 +00:00
|
|
|
use MediaWiki\User\User;
|
2023-02-26 12:51:08 +00:00
|
|
|
use Wikimedia\Rdbms\LBFactory;
|
2020-10-24 11:58:46 +00:00
|
|
|
|
|
|
|
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;
|
2021-01-05 13:33:45 +00:00
|
|
|
/** @var EditRevUpdater */
|
|
|
|
private $editRevUpdater;
|
2023-02-26 12:51:08 +00:00
|
|
|
/** @var LBFactory */
|
|
|
|
private $lbFactory;
|
2020-10-24 11:58:46 +00:00
|
|
|
/** @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
|
2021-01-05 13:33:45 +00:00
|
|
|
* @param EditRevUpdater $editRevUpdater
|
2023-02-26 12:51:08 +00:00
|
|
|
* @param LBFactory $lbFactory
|
2020-10-24 11:58:46 +00:00
|
|
|
* @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,
|
2021-01-05 13:33:45 +00:00
|
|
|
EditRevUpdater $editRevUpdater,
|
2023-02-26 12:51:08 +00:00
|
|
|
LBFactory $lbFactory,
|
2020-10-24 11:58:46 +00:00
|
|
|
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;
|
2021-01-05 13:33:45 +00:00
|
|
|
$this->editRevUpdater = $editRevUpdater;
|
2023-02-26 12:51:08 +00:00
|
|
|
$this->lbFactory = $lbFactory;
|
2020-10-24 11:58:46 +00:00
|
|
|
$this->options = $options;
|
|
|
|
$this->wikiID = $wikiID;
|
|
|
|
$this->requestIP = $requestIP;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param Title $title
|
|
|
|
* @param User $user
|
2021-01-02 14:01:00 +00:00
|
|
|
* @param VariableHolder $vars
|
2020-10-24 11:58:46 +00:00
|
|
|
* @return AbuseLogger
|
|
|
|
*/
|
|
|
|
public function newLogger(
|
|
|
|
Title $title,
|
|
|
|
User $user,
|
2021-01-02 14:01:00 +00:00
|
|
|
VariableHolder $vars
|
2021-07-21 18:51:12 +00:00
|
|
|
): AbuseLogger {
|
2020-10-24 11:58:46 +00:00
|
|
|
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,
|
2021-01-05 13:33:45 +00:00
|
|
|
$this->editRevUpdater,
|
2023-02-26 12:51:08 +00:00
|
|
|
$this->lbFactory,
|
2020-10-24 11:58:46 +00:00
|
|
|
$this->options,
|
|
|
|
$this->wikiID,
|
|
|
|
$this->requestIP,
|
|
|
|
$title,
|
|
|
|
$user,
|
|
|
|
$vars
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|