2020-06-05 09:39:50 +00:00
|
|
|
<?php
|
|
|
|
|
2021-02-11 02:37:19 +00:00
|
|
|
namespace MediaWiki\Extension\Nuke\Hooks;
|
|
|
|
|
2020-06-05 09:39:50 +00:00
|
|
|
use MediaWiki\HookContainer\HookContainer;
|
2023-08-19 04:17:58 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2020-06-05 09:39:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle running Nuke's hooks
|
|
|
|
* @author DannyS712
|
|
|
|
*/
|
|
|
|
class NukeHookRunner implements NukeDeletePageHook, NukeGetNewPagesHook {
|
|
|
|
|
2024-04-19 13:10:15 +00:00
|
|
|
private HookContainer $hookContainer;
|
2020-06-05 09:39:50 +00:00
|
|
|
|
|
|
|
public function __construct( HookContainer $hookContainer ) {
|
|
|
|
$this->hookContainer = $hookContainer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-31 20:07:24 +00:00
|
|
|
* @inheritDoc
|
2020-06-05 09:39:50 +00:00
|
|
|
*/
|
|
|
|
public function onNukeDeletePage( Title $title, string $reason, bool &$deletionResult ) {
|
|
|
|
return $this->hookContainer->run(
|
|
|
|
'NukeDeletePage',
|
|
|
|
[ $title, $reason, &$deletionResult ]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-31 20:07:24 +00:00
|
|
|
* @inheritDoc
|
2020-06-05 09:39:50 +00:00
|
|
|
*/
|
|
|
|
public function onNukeGetNewPages(
|
|
|
|
string $username,
|
|
|
|
?string $pattern,
|
|
|
|
?int $namespace,
|
|
|
|
int $limit,
|
|
|
|
array &$pages
|
|
|
|
) {
|
|
|
|
return $this->hookContainer->run(
|
|
|
|
'NukeGetNewPages',
|
|
|
|
[ $username, $pattern, $namespace, $limit, &$pages ]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|