| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\Nuke\Hooks; |
| 4 |
|
| 5 |
use MediaWiki\HookContainer\HookContainer; |
| 6 |
use MediaWiki\Title\Title; |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class NukeHookRunner implements NukeDeletePageHook, NukeGetNewPagesHook { |
| 13 |
|
| 14 |
private HookContainer $hookContainer; |
| 15 |
|
| 16 |
public function __construct( HookContainer $hookContainer ) { |
| 17 |
$this->hookContainer = $hookContainer; |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
public function onNukeDeletePage( Title $title, string $reason, bool &$deletionResult ) { |
| 24 |
return $this->hookContainer->run( |
| 25 |
'NukeDeletePage', |
| 26 |
[ $title, $reason, &$deletionResult ] |
| 27 |
); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
public function onNukeGetNewPages( |
| 34 |
string $username, |
| 35 |
?string $pattern, |
| 36 |
?int $namespace, |
| 37 |
int $limit, |
| 38 |
array &$pages |
| 39 |
) { |
| 40 |
return $this->hookContainer->run( |
| 41 |
'NukeGetNewPages', |
| 42 |
[ $username, $pattern, $namespace, $limit, &$pages ] |
| 43 |
); |
| 44 |
} |
| 45 |
|
| 46 |
} |