diff options
author | Tim Starling <tstarling@wikimedia.org> | 2020-03-04 09:50:34 +1100 |
---|---|---|
committer | Tim Starling <tstarling@wikimedia.org> | 2020-04-20 13:31:05 +1000 |
commit | f5aaf75ad15813bfeb93dcb4e5fbaaa52b23c7fe (patch) | |
tree | 1598e7d4c3d1e6d2914de4ae61ca01b2cbd3f470 /includes/deferred/Hook | |
parent | cedee2b62058a3834c2d883eeeecc2707eed9c93 (diff) | |
download | mediawikicore-f5aaf75ad15813bfeb93dcb4e5fbaaa52b23c7fe.tar.gz mediawikicore-f5aaf75ad15813bfeb93dcb4e5fbaaa52b23c7fe.zip |
Automatically generated hook interfaces
Add hook interfaces which were generated by a script which parses
hooks.txt and identifies caller namespaces and directories.
Hook interfaces are mostly placed in a Hook/ subdirectory
relative to the caller location. When there are callers in multiple
directories, a "primary" caller was manually selected. The exceptions to
this are:
* The source root, maintenance and tests, which use includes/Hook. Test
hooks need to be autoloadable in a non-test request so that
implementing test interfaces in a generic handler will not fail.
* resources uses includes/resourceloader/Hook
* The following third-level subdirectories had their hooks placed in
the parent ../Hook:
* includes/filerepo/file
* includes/search/searchwidgets
* includes/specials/forms
* includes/specials/helpers
* includes/specials/pagers
Parameters marked as legacy references in hooks.txt are passed
by value in the interfaces.
Bug: T240307
Change-Id: I6efe2e7dd1f0c6a3d0f4d100a4c34e41f8428720
Diffstat (limited to 'includes/deferred/Hook')
-rw-r--r-- | includes/deferred/Hook/LinksUpdateAfterInsertHook.php | 22 | ||||
-rw-r--r-- | includes/deferred/Hook/LinksUpdateCompleteHook.php | 21 | ||||
-rw-r--r-- | includes/deferred/Hook/LinksUpdateConstructedHook.php | 19 | ||||
-rw-r--r-- | includes/deferred/Hook/LinksUpdateHook.php | 20 |
4 files changed, 82 insertions, 0 deletions
diff --git a/includes/deferred/Hook/LinksUpdateAfterInsertHook.php b/includes/deferred/Hook/LinksUpdateAfterInsertHook.php new file mode 100644 index 000000000000..37b02dd475d1 --- /dev/null +++ b/includes/deferred/Hook/LinksUpdateAfterInsertHook.php @@ -0,0 +1,22 @@ +<?php + +namespace MediaWiki\Hook; + +/** + * @stable for implementation + * @ingroup Hooks + */ +interface LinksUpdateAfterInsertHook { + /** + * At the end of LinksUpdate::incrTableUpdate() after + * each link table insert. For example, pagelinks, imagelinks, externallinks. + * + * @since 1.35 + * + * @param ?mixed $linksUpdate LinksUpdate object + * @param ?mixed $table the table to insert links to + * @param ?mixed $insertions an array of links to insert + * @return bool|void True or no return value to continue or false to abort + */ + public function onLinksUpdateAfterInsert( $linksUpdate, $table, $insertions ); +} diff --git a/includes/deferred/Hook/LinksUpdateCompleteHook.php b/includes/deferred/Hook/LinksUpdateCompleteHook.php new file mode 100644 index 000000000000..273fb5c5ded4 --- /dev/null +++ b/includes/deferred/Hook/LinksUpdateCompleteHook.php @@ -0,0 +1,21 @@ +<?php + +namespace MediaWiki\Hook; + +/** + * @stable for implementation + * @ingroup Hooks + */ +interface LinksUpdateCompleteHook { + /** + * At the end of LinksUpdate::doUpdate() when updating, + * including delete and insert, has completed for all link tables + * + * @since 1.35 + * + * @param ?mixed $linksUpdate the LinksUpdate object + * @param ?mixed $ticket prior result of LBFactory::getEmptyTransactionTicket() + * @return bool|void True or no return value to continue or false to abort + */ + public function onLinksUpdateComplete( $linksUpdate, $ticket ); +} diff --git a/includes/deferred/Hook/LinksUpdateConstructedHook.php b/includes/deferred/Hook/LinksUpdateConstructedHook.php new file mode 100644 index 000000000000..2c40389f9a74 --- /dev/null +++ b/includes/deferred/Hook/LinksUpdateConstructedHook.php @@ -0,0 +1,19 @@ +<?php + +namespace MediaWiki\Hook; + +/** + * @stable for implementation + * @ingroup Hooks + */ +interface LinksUpdateConstructedHook { + /** + * At the end of LinksUpdate() is construction. + * + * @since 1.35 + * + * @param ?mixed $linksUpdate the LinksUpdate object + * @return bool|void True or no return value to continue or false to abort + */ + public function onLinksUpdateConstructed( $linksUpdate ); +} diff --git a/includes/deferred/Hook/LinksUpdateHook.php b/includes/deferred/Hook/LinksUpdateHook.php new file mode 100644 index 000000000000..54ad8c9ca4eb --- /dev/null +++ b/includes/deferred/Hook/LinksUpdateHook.php @@ -0,0 +1,20 @@ +<?php + +namespace MediaWiki\Hook; + +/** + * @stable for implementation + * @ingroup Hooks + */ +interface LinksUpdateHook { + /** + * At the beginning of LinksUpdate::doUpdate() just before the + * actual update. + * + * @since 1.35 + * + * @param ?mixed $linksUpdate the LinksUpdate object + * @return bool|void True or no return value to continue or false to abort + */ + public function onLinksUpdate( $linksUpdate ); +} |