deleteAnArticle, exportArticle, etc., we can concentrate it all in an extension
file:
- function reverseArticleTitle( $article ) {
+ function onArticleShow( &$article ) {
# ...
}
- function reverseForExport( $article ) {
+ function onArticleDelete( &$article ) {
# ...
}
-The setup function for the extension just has to add its hook functions to the
-appropriate events:
-
- setupTitleReversingExtension() {
- global $wgHooks;
+ function onArticleExport( &$article ) {
+ # ...
+ }
- $wgHooks['ArticleShow'][] = 'reverseArticleTitle';
- $wgHooks['ArticleDelete'][] = 'reverseArticleTitle';
- $wgHooks['ArticleExport'][] = 'reverseForExport';
+General practice is to have a dedicated file for functions activated by hooks,
+which functions named 'onHookName'. In the example above, the file
+'ReverseHooks.php' includes the functions that should be activated by the
+'ArticleShow', 'ArticleDelete', and 'ArticleExport' hooks. The 'extension.json'
+file with the extension's registration just has to add its hook functions
+to the appropriate events:
+
+ "Hooks": {
+ "ArticleShow": "ReverseHooks:onArticleShow",
+ "ArticleDelete": "ReverseHooks::onArticleDelete",
+ "ArticleExport": "ReverseHooks::onArticleExport"
}
Having all this code related to the title-reversion option in one place means
&$skin: Skin object to be used with the list
&$list: List object (defaults to NULL, change it to an object instance and
return false override the list derivative used)
+$groups Array of ChangesListFilterGroup objects (added in 1.34)
'FileDeleteComplete': When a file is deleted.
&$file: reference to the deleted file
&$oldTitle: old title (object)
&$newTitle: new title (object)
+'SpecialMuteModifyFormFields': Add more fields to Special:Mute
+$sp: SpecialPage object, for context
+&$fields: Current HTMLForm fields descriptors
+
'SpecialNewpagesConditions': Called when building sql query for
Special:NewPages.
&$special: NewPagesPager object (subclass of ReverseChronologicalPager)
'SpecialSearchResults': Called before search result display
$term: string of search term
-&$titleMatches: empty or SearchResultSet object
-&$textMatches: empty or SearchResultSet object
+&$titleMatches: empty or ISearchResultSet object
+&$textMatches: empty or ISearchResultSet object
'SpecialSearchResultsPrepend': Called immediately before returning HTML
on the search results page. Useful for including an external search
MessageSpecifier instance (you might want to use ApiMessage to provide machine
-readable details for the API).
-'UploadVerification': DEPRECATED since 1.28! Use UploadVerifyFile instead.
-Additional chances to reject an uploaded file.
-$saveName: (string) destination file name
-$tempName: (string) filesystem path to the temporary file for checks
-&$error: (string) output: message key for message to show if upload canceled by
- returning false. May also be an array, where the first element is the message
- key and the remaining elements are used as parameters to the message.
-
'UploadVerifyFile': extra file verification, based on MIME type, etc. Preferred
in most cases over UploadVerification.
$upload: (object) an instance of UploadBase, with all info about the upload