Move documentation from hooks.txt to hook interfaces

The new system allows to have documentation directly at the interfaces

Change-Id: I82f6f87d145cc43b2dd5b7d1fa256850b50ca63f
This commit is contained in:
Umherirrender 2021-03-31 22:07:24 +02:00
parent 9add2a096f
commit e79b52ee8a
4 changed files with 9 additions and 42 deletions

View file

@ -1,20 +0,0 @@
hooks.txt
This document describes the events triggered by the Nuke extension.
For more information about events and hooks in general see mediawiki/docs/hooks.txt in gerrit.
==Events and parameters==
'NukeGetNewPages': After searching for pages to delete. Can be used to add and remove pages.
$username: the username filter specified by the user
$pattern: the pattern filter specified by the user
$namespace: the namespace filter specified by the user
$limit: the limit filter specified by the user
&$pages: list of pages title already retrieved
'NukeDeletePage': Allows other extensions to handle the deletion of titles.
Return true to let Nuke handle the deletion or false if it was already handled in the hook.
$title: title to delete
$reason: reason given by the user for deletion
&$deletionResult: Whether the deletion was successful or not

View file

@ -7,13 +7,15 @@ use Title;
interface NukeDeletePageHook {
/**
* Hook runner for the `NukeDeletePage` hook
*
* Allows other extensions to handle the deletion of titles
* Return true to let Nuke handle the deletion or false if it was already handled in the hook.
*
* @param Title $title title to delete
* @param string $reason reason for deletion
* @param bool &$deletionResult Whether the deletion was successful or not
* @return bool|void
* @return bool|void True or no return value to let Nuke handle the deletion or
* false if it was already handled in the hook.
*/
public function onNukeDeletePage( Title $title, string $reason, bool &$deletionResult );
}

View file

@ -5,6 +5,8 @@ namespace MediaWiki\Extension\Nuke\Hooks;
interface NukeGetNewPagesHook {
/**
* Hook runner for the `NukeGetNewPages` hook
*
* After searching for pages to delete. Can be used to add and remove pages.
*
* @param string $username username filter applied
@ -12,7 +14,7 @@ interface NukeGetNewPagesHook {
* @param ?int $namespace namespace filter applied
* @param int $limit limit filter applied
* @param array &$pages page titles already retrieved
* @return bool|void
* @return bool|void True or no return value to continue or false to abort
*/
public function onNukeGetNewPages(
string $username,

View file

@ -22,15 +22,7 @@ class NukeHookRunner implements NukeDeletePageHook, NukeGetNewPagesHook {
}
/**
* Hook runner for the `NukeDeletePage` hook
*
* Allows other extensions to handle the deletion of titles
* Return true to let Nuke handle the deletion or false if it was already handled in the hook.
*
* @param Title $title title to delete
* @param string $reason reason for deletion
* @param bool &$deletionResult Whether the deletion was successful or not
* @return bool|void
* @inheritDoc
*/
public function onNukeDeletePage( Title $title, string $reason, bool &$deletionResult ) {
return $this->hookContainer->run(
@ -40,16 +32,7 @@ class NukeHookRunner implements NukeDeletePageHook, NukeGetNewPagesHook {
}
/**
* Hook runner for the `NukeGetNewPages` hook
*
* After searching for pages to delete. Can be used to add and remove pages.
*
* @param string $username username filter applied
* @param ?string $pattern pattern filter applied
* @param ?int $namespace namespace filter applied
* @param int $limit limit filter applied
* @param array &$pages page titles already retrieved
* @return bool|void
* @inheritDoc
*/
public function onNukeGetNewPages(
string $username,