From a628f41ea9bb2d8109b7afddb64896f9ca04c413 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Wed, 14 Oct 2015 21:36:08 +0200 Subject: [PATCH] Allow findHooks.php to compare parameter references of hooks Check if all hooks in hooks.txt have a &, if the code also have & and the other way round. Fix all hooks in hooks.txt to have a clean run of the script. Change-Id: I1b45253e20dc310e825cdc17e0e2e9c8fb315bab --- docs/hooks.txt | 400 +++++++++++++++++++------------------- maintenance/findHooks.php | 20 +- 2 files changed, 215 insertions(+), 205 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index ca5da148ff..7c79e729a5 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -245,7 +245,7 @@ $user: the User object about to be created (read-only, incomplete) 'AbortAutoblock': Return false to cancel an autoblock. $autoblockip: The IP going to be autoblocked. -$block: The block from which the autoblock is coming. +&$block: The block from which the autoblock is coming. 'AbortChangePassword': Return false to cancel password change. $user: the User object to which the password change is occuring @@ -326,7 +326,7 @@ just before adding its HTML to parser output. $parser: Parser object that called the hook $ig: Gallery, an object of one of the gallery classes (inheriting from ImageGalleryBase) -$html: HTML generated by the gallery +&$html: HTML generated by the gallery 'AlternateEdit': Before checking if a user can edit a page and before showing the edit form ( EditPage::edit() ). This is triggered on &action=edit. @@ -469,7 +469,7 @@ function is func($pageid, $title), where $pageid is the page ID of the page the token is requested for and $title is the associated Title object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). -$tokenFunctions: array(action => callback) +&$tokenFunctions: array(action => callback) 'APIQueryRecentChangesTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. @@ -482,7 +482,7 @@ page associated to the revision the token is requested for, $title the associated Title object and $rc the associated RecentChange object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). -$tokenFunctions: array(action => callback) +&$tokenFunctions: array(action => callback) 'APIQueryRevisionsTokens': DEPRECATED! Use ApiQueryTokensRegisterTypes instead. Use this hook to add custom tokens to prop=revisions. Every token has an @@ -494,7 +494,7 @@ page associated to the revision the token is requested for, $title the associated Title object and $rev the associated Revision object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). -$tokenFunctions: array(action => callback) +&$tokenFunctions: array(action => callback) 'APIQuerySiteInfoGeneralInfo': Use this hook to add extra information to the sites general information. @@ -518,7 +518,7 @@ false if the user isn't allowed to obtain it. The prototype of the callback function is func($user) where $user is the User object. In the hook, just add your callback to the $tokenFunctions array and return true (returning false makes no sense). -$tokenFunctions: array(action => callback) +&$tokenFunctions: array(action => callback) 'ApiRsdServiceApis': Add or remove APIs from the RSD services list. Each service should have its own entry in the $apis array and have a unique name, passed as @@ -541,12 +541,12 @@ $logTypes: Array of log types being queried 'ArticleAfterFetchContent': DEPRECATED! Use ArticleAfterFetchContentObject instead. After fetching content of an article from the database. -$article: the article (object) being loaded from the database +&$article: the article (object) being loaded from the database &$content: the content (string) of the article 'ArticleAfterFetchContentObject': After fetching content of an article from the database. -$article: the article (object) being loaded from the database +&$article: the article (object) being loaded from the database &$content: the content of the article, as a Content object 'ArticleConfirmDelete': Before writing the confirmation form for article @@ -568,12 +568,12 @@ $title: title of the page $output: reference to $wgOut 'ArticleDelete': Before an article is deleted. -$wikiPage: the WikiPage (object) being deleted -$user: the user (object) deleting the article -$reason: the reason (string) the article is being deleted -$error: if the deletion was prohibited, the (raw HTML) error message to display +&$wikiPage: the WikiPage (object) being deleted +&$user: the user (object) deleting the article +&$reason: the reason (string) the article is being deleted +&$error: if the deletion was prohibited, the (raw HTML) error message to display (added in 1.13) -$status: Status object, modify this to throw an error. Overridden by $error +&$status: Status object, modify this to throw an error. Overridden by $error (added in 1.20) $suppress: Whether this is a suppression deletion or not (added in 1.27) @@ -582,8 +582,8 @@ $title: Title of the article that has been deleted. $outputPage: OutputPage that can be used to append the output. 'ArticleDeleteComplete': After an article is deleted. -$wikiPage: the WikiPage that was deleted -$user: the user that deleted the article +&$wikiPage: the WikiPage that was deleted +&$user: the user that deleted the article $reason: the reason the article was deleted $id: id of the article that was deleted $content: the Content of the deleted page @@ -596,19 +596,19 @@ $recipient: User (object) who's talk page was edited 'ArticleEditUpdates': When edit updates (mainly link tracking) are made when an article has been changed. -$wikiPage: the WikiPage (object) -$editInfo: data holder that includes the parser output ($editInfo->output) for +&$wikiPage: the WikiPage (object) +&$editInfo: data holder that includes the parser output ($editInfo->output) for that page after the change $changed: bool for if the page was changed 'ArticleEditUpdatesDeleteFromRecentchanges': Before deleting old entries from recentchanges table, return false to not delete old entries. -$wikiPage: WikiPage (object) being modified +&$wikiPage: WikiPage (object) being modified 'ArticleFromTitle': when creating an article object from a title object using Wiki::articleFromTitle(). -$title: Title (object) used to create the article object -$article: Article (object) that will be returned +&$title: Title (object) used to create the article object +&$article: Article (object) that will be returned $context: IContextSource (object) 'ArticleInsertComplete': DEPRECATED! Use PageContentInsertComplete. @@ -628,34 +628,34 @@ $targetTitle: target title (object) $destTitle: destination title (object) 'ArticlePageDataAfter': After loading data of an article from the database. -$wikiPage: WikiPage (object) whose data were loaded -$row: row (object) returned from the database server +&$wikiPage: WikiPage (object) whose data were loaded +&$row: row (object) returned from the database server 'ArticlePageDataBefore': Before loading data of an article from the database. -$wikiPage: WikiPage (object) that data will be loaded -$fields: fields (array) to load from the database +&$wikiPage: WikiPage (object) that data will be loaded +&$fields: fields (array) to load from the database 'ArticlePrepareTextForEdit': Called when preparing text to be saved. $wikiPage: the WikiPage being saved $popts: parser options to be used for pre-save transformation 'ArticleProtect': Before an article is protected. -$wikiPage: the WikiPage being protected -$user: the user doing the protection +&$wikiPage: the WikiPage being protected +&$user: the user doing the protection $protect: Set of restriction keys $reason: Reason for protect 'ArticleProtectComplete': After an article is protected. -$wikiPage: the WikiPage that was protected -$user: the user who did the protection +&$wikiPage: the WikiPage that was protected +&$user: the user who did the protection $protect: Set of restriction keys $reason: Reason for protect 'ArticlePurge': Before executing "&action=purge". -$wikiPage: WikiPage (object) to purge +&$wikiPage: WikiPage (object) to purge 'ArticleRevisionUndeleted': After an article revision is restored. -$title: the article title +&$title: the article title $revision: the revision $oldPageID: the page ID of the revision when archived (may be null) @@ -695,7 +695,7 @@ $status: Status object about to be returned by doEditContent() $baseRevId: the rev ID (or false) this edit was based on 'ArticleUndelete': When one or more revisions of an article are restored. -$title: Title corresponding to the article restored +&$title: Title corresponding to the article restored $create: Whether or not the restoration caused the page to be created (i.e. it didn't exist before). $comment: The comment associated with the undeletion. @@ -708,7 +708,7 @@ $user: User who is performing the log action 'ArticleUpdateBeforeRedirect': After a page is updated (usually on save), before the user is redirected back to the page. -&$article: the article +$article: the article &$sectionanchor: The section anchor link (e.g. "#overview" ) &$extraq: Extra query parameters which can be added via hooked functions @@ -734,7 +734,7 @@ viewing. 'ArticleViewRedirect': Before setting "Redirected from ..." subtitle when a redirect was followed. -$article: target article (object) +&$article: target article (object) 'AuthPluginAutoCreate': Called when creating a local account for an user logged in from an external authentication method. @@ -748,7 +748,7 @@ Gives a chance for an extension to set it programmatically to a variable class. $type: condition type $args: arguments $user: user -$result: result of checking autopromote condition +&$result: result of checking autopromote condition 'BacklinkCacheGetConditions': Allows to set conditions for query when links to certain title are fetched. @@ -796,7 +796,7 @@ $context: IContextSource object 'BeforeInitialize': Before anything is initialized in MediaWiki::performRequest(). &$title: Title being used for request -$unused: null +&$unused: null &$output: OutputPage object &$user: User $request: WebRequest object @@ -852,8 +852,8 @@ $image: File &$mto: null, set to a MediaTransformOutput 'BlockIp': Before an IP address or user is blocked. -$block: the Block object about to be saved -$user: the user _doing_ the block (not the one being blocked) +&$block: the Block object about to be saved +&$user: the user _doing_ the block (not the one being blocked) &$reason: if the hook is aborted, the error message to be returned in an array 'BlockIpComplete': After an IP address or user is blocked. @@ -891,7 +891,7 @@ $category: Category that page was removed from $wikiPage: WikiPage that was removed 'CategoryPageView': Before viewing a categorypage in CategoryPage::view. -$catpage: CategoryPage instance +&$catpage: CategoryPage instance 'CategoryViewer::doCategoryQuery': After querying for pages to be displayed in a Category page. Gives extensions the opportunity to batch load any @@ -1070,7 +1070,7 @@ $article: Article being edited $user: User performing the edit 'DatabaseOraclePostInit': Called after initialising an Oracle database -&$db: the DatabaseOracle object +$db: the DatabaseOracle object 'DeletedContribsPager::reallyDoQuery': Called before really executing the query for Special:DeletedContributions @@ -1102,8 +1102,8 @@ $newRev: Revision object of the "new" revision 'DisplayOldSubtitle': before creating subtitle when browsing old versions of an article -$article: article (object) being viewed -$oldid: oldid (int) being viewed +&$article: article (object) being viewed +&$oldid: oldid (int) being viewed 'DoEditSectionLink': DEPRECATED! Use SkinEditSectionLinks instead. Override the HTML generated for section edit links @@ -1173,16 +1173,16 @@ return value is ignored (should always return true) 'EditPage::showEditForm:fields': allows injection of form field into edit form Return value is ignored (should always return true) -$editor: the EditPage instance for reference -$out: an OutputPage instance to write to +&$editor: the EditPage instance for reference +&$out: an OutputPage instance to write to 'EditPage::showEditForm:initial': before showing the edit form Return false to halt editing; you'll need to handle error messages, etc. yourself. Alternatively, modifying $error and returning true will cause the contents of $error to be echoed at the top of the edit form as wikitext. Return true without altering $error to allow the edit to proceed. -$editor: EditPage instance (object) -$out: an OutputPage instance to write to +&$editor: EditPage instance (object) +&$out: an OutputPage instance to write to 'EditPage::showReadOnlyForm:initial': similar to EditPage::showEditForm:initial but for the read-only 'view source' variant of the edit form. @@ -1267,21 +1267,21 @@ $title: title of page being edited 'EmailConfirmed': When checking that the user's email address is "confirmed". This runs before the other checks, such as anonymity and the real check; return true to allow those checks to occur, and false if checking is done. -$user: User being checked -$confirmed: Whether or not the email address is confirmed +&$user: User being checked +&$confirmed: Whether or not the email address is confirmed 'EmailUser': Before sending email from one user to another. -$to: MailAddress object of receiving user -$from: MailAddress object of sending user -$subject: subject of the mail -$text: text of the mail +&$to: MailAddress object of receiving user +&$from: MailAddress object of sending user +&$subject: subject of the mail +&$text: text of the mail &$error: Out-param for an error 'EmailUserCC': Before sending the copy of the email to the author. -$to: MailAddress object of receiving user -$from: MailAddress object of sending user -$subject: subject of the mail -$text: text of the mail +&$to: MailAddress object of receiving user +&$from: MailAddress object of sending user +&$subject: subject of the mail +&$text: text of the mail 'EmailUserComplete': After sending email from one user to another. $to: MailAddress object of receiving user @@ -1290,7 +1290,7 @@ $subject: subject of the mail $text: text of the mail 'EmailUserForm': After building the email user form object. -$form: HTMLForm object +&$form: HTMLForm object 'EmailUserPermissionsErrors': to retrieve permissions errors for emailing a user. @@ -1343,12 +1343,12 @@ $user: User the list is being fetched for return false override the list derivative used) 'FileDeleteComplete': When a file is deleted. -$file: reference to the deleted file -$oldimage: in case of the deletion of an old image, the name of the old file -$article: in case all revisions of the file are deleted a reference to the +&$file: reference to the deleted file +&$oldimage: in case of the deletion of an old image, the name of the old file +&$article: in case all revisions of the file are deleted a reference to the WikiFilePage associated with the file. -$user: user who performed the deletion -$reason: reason +&$user: user who performed the deletion +&$reason: reason 'FileTransformed': When a file is transformed and moved into storage. $file: reference to the File object @@ -1389,11 +1389,11 @@ gallery. 'GetAutoPromoteGroups': When determining which autopromote groups a user is entitled to be in. -&$user: user to promote. +$user: user to promote. &$promote: groups that will be added. 'GetBlockedStatus': after loading blocking status of an user from the database -$user: user (object) being checked +&$user: user (object) being checked 'GetCacheVaryCookies': Get cookies that should vary cache options. $out: OutputPage object @@ -1402,8 +1402,8 @@ $out: OutputPage object 'GetCanonicalURL': Modify fully-qualified URLs used for IRC and e-mail notifications. -$title: Title object of page -$url: string value as output (out parameter, can modify) +&$title: Title object of page +&$url: string value as output (out parameter, can modify) $query: query options passed to Title::getCanonicalURL() 'GetDefaultSortkey': Override the default sortkey for a page. @@ -1439,8 +1439,8 @@ $single: Only extract the current language; if false, the prop value should &$maxCacheTime: how long the results can be cached 'GetFullURL': Modify fully-qualified URLs used in redirects/export/offsite data. -$title: Title object of page -$url: string value as output (out parameter, can modify) +&$title: Title object of page +&$url: string value as output (out parameter, can modify) $query: query options passed to Title::getFullURL() 'GetHumanTimestamp': Pre-emptively override the human-readable timestamp @@ -1453,8 +1453,8 @@ $user: User whose preferences are being used to make timestamp $lang: Language that will be used to render the timestamp 'GetInternalURL': Modify fully-qualified URLs used for squid cache purging. -$title: Title object of page -$url: string value as output (out parameter, can modify) +&$title: Title object of page +&$url: string value as output (out parameter, can modify) $query: query options passed to Title::getInternalURL() 'GetIP': modify the ip of the current user (called only once). @@ -1470,17 +1470,17 @@ working with internal urls (non-interwiki) then it may be preferable to work with the GetLocalURL::Internal or GetLocalURL::Article hooks as GetLocalURL can be buggy for internal urls on render if you do not re-implement the horrible hack that Title::getLocalURL uses in your own extension. -$title: Title object of page +&$title: Title object of page &$url: string value as output (out parameter, can modify) $query: query options passed to Title::getLocalURL() 'GetLocalURL::Article': Modify local URLs specifically pointing to article paths without any fancy queries or variants. -$title: Title object of page +&$title: Title object of page &$url: string value as output (out parameter, can modify) 'GetLocalURL::Internal': Modify local URLs to internal pages. -$title: Title object of page +&$title: Title object of page &$url: string value as output (out parameter, can modify) $query: query options passed to Title::getLocalURL() @@ -1527,10 +1527,10 @@ For consistency, error messages should be plain text with no special coloring, bolding, etc. to show that they're errors; presenting them properly to the user as errors is done by the caller. -$title: Title object being checked against -$user: Current user object +&$title: Title object being checked against +&$user: Current user object $action: Action being checked -$result: User permissions error to add. If none, return true. +&$result: User permissions error to add. If none, return true. 'getUserPermissionsErrorsExpensive': Equal to getUserPermissionsErrors, but is called only if expensive checks are enabled. Add a permissions error when @@ -1541,10 +1541,10 @@ to provide machine-readable details for the API). For consistency, error messages should be plain text with no special coloring, bolding, etc. to show that they're errors; presenting them properly to the user as errors is done by the caller. -$title: Title object being checked against -$user: Current user object +&$title: Title object being checked against +&$user: Current user object $action: Action being checked -$result: User permissions error to add. If none, return true. +&$result: User permissions error to add. If none, return true. 'GitViewers': Called when generating the list of git viewers for Special:Version, use this to change the list. @@ -1575,8 +1575,8 @@ just modify a few things using call-by-reference. 'ImageOpenShowImageInlineBefore': Call potential extension just before showing the image on an image page. -$imagePage: ImagePage object ($this) -$output: $wgOut +&$imagePage: ImagePage object ($this) +&$output: $wgOut 'ImagePageAfterImageLinks': Called after the image links section on an image page is built. @@ -1620,7 +1620,7 @@ $logInfo: Array of information 'ImportHandlePageXMLTag': When parsing a XML tag in a page. Return false to stop further processing of the tag $reader: XMLReader object -$pageInfo: Array of information +&$pageInfo: Array of information 'ImportHandleRevisionXMLTag': When parsing a XML tag in a page revision. Return false to stop further processing of the tag @@ -1647,11 +1647,11 @@ $context: IContextSource object &$pageInfo: Array of information 'InitializeArticleMaybeRedirect': MediaWiki check to see if title is a redirect. -$title: Title object for the current page -$request: WebRequest -$ignoreRedirect: boolean to skip redirect check -$target: Title/string of redirect target -$article: Article object +&$title: Title object for the current page +&$request: WebRequest +&$ignoreRedirect: boolean to skip redirect check +&$target: Title/string of redirect target +&$article: Article object 'InternalParseBeforeLinks': during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. @@ -1684,11 +1684,11 @@ Callee may modify $url and $query, URL will be constructed as $url . $query $rc: RecentChange object that triggered url generation 'IsFileCacheable': Override the result of Article::isFileCacheable() (if true) -$article: article (object) being checked +&$article: article (object) being checked 'IsTrustedProxy': Override the result of wfIsTrustedProxy() -$ip: IP being check -$result: Change this value to override the result of wfIsTrustedProxy() +&$ip: IP being check +&$result: Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl': Override the result of UploadFromUrl::isAllowedUrl() $url: URL used to upload from @@ -1711,7 +1711,7 @@ $code: The language code or the language we're looking for a messages file for 'LanguageGetMagic': DEPRECATED! Use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language -$magicExtensions: associative array of magic words synonyms +&$magicExtensions: associative array of magic words synonyms $lang: language code (string) 'LanguageGetNamespaces': Provide custom ordering for namespaces or @@ -1722,7 +1722,7 @@ CanonicalNamespaces for that. 'LanguageGetSpecialPageAliases': DEPRECATED! Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language -$specialPageAliases: associative array of magic words synonyms +&$specialPageAliases: associative array of magic words synonyms $lang: language code (string) 'LanguageGetTranslatedLanguageNames': Provide translated language names. @@ -1816,15 +1816,15 @@ including delete and insert, has completed for all link tables &$tags: The list of tags. 'LoadExtensionSchemaUpdates': Called during database installation and updates. -&$updater: A DatabaseUpdater subclass +$updater: A DatabaseUpdater subclass 'LocalFile::getHistory': Called before file history query performed. -$file: the File object -$tables: tables -$fields: select fields -$conds: conditions -$opts: query options -$join_conds: JOIN conditions +&$file: the File object +&$tables: tables +&$fields: select fields +&$conds: conditions +&$opts: query options +&$join_conds: JOIN conditions 'LocalFilePurgeThumbnails': Called before thumbnails for a local file a purged. $file: the File object @@ -1942,7 +1942,7 @@ Special:LonelyPages. &$joinConds: join conditions for the query 'MagicWordwgVariableIDs': When defining new magic words IDs. -$variableIDs: array of strings +&$variableIDs: array of strings 'MaintenanceRefreshLinksInit': before executing the refreshLinks.php maintenance script. @@ -1958,14 +1958,14 @@ $out: The OutputPage which called the hook, can be used to get the real title. 'MarkPatrolled': Before an edit is marked patrolled. $rcid: ID of the revision to be marked patrolled -$user: the user (object) marking the revision as patrolled +&$user: the user (object) marking the revision as patrolled $wcOnlySysopsCanPatrol: config setting indicating whether the user needs to be a sysop in order to mark an edit patrolled. $auto: true if the edit is being marked as patrolled automatically 'MarkPatrolledComplete': After an edit is marked patrolled. $rcid: ID of the revision marked as patrolled -$user: user (object) who marked the edit patrolled +&$user: user (object) who marked the edit patrolled $wcOnlySysopsCanPatrol: config setting indicating whether the user must be a sysop to patrol the edit. $auto: true if the edit is being marked as patrolled automatically @@ -1993,7 +1993,7 @@ $text: new contents of the page. 'MessagesPreLoad': When loading a message from the database. $title: title of the message (string) -$message: value (string), change it to the message you want to define +&$message: value (string), change it to the message you want to define 'MimeMagicGuessFromContent': Allows MW extensions guess the MIME by content. $mimeMagic: Instance of MimeMagic. @@ -2043,7 +2043,7 @@ $status: Status object to pass error messages to 'NamespaceIsMovable': Called when determining if it is possible to pages in a namespace. $index: Integer; the index of the namespace being checked. -$result: Boolean; whether MediaWiki currently thinks that pages in this +&$result: Boolean; whether MediaWiki currently thinks that pages in this namespace are movable. Hooks may change this value to override the return value of MWNamespace::isMovable(). @@ -2076,7 +2076,7 @@ displayed. return false to omit the line from RecentChanges and Watchlist special pages. &$changeslist: The OldChangesList instance. &$s: HTML of the form "
  • ...
  • " containing one RC entry. -&$rc: The RecentChange object. +$rc: The RecentChange object. &$classes: array of css classes for the
  • element 'OpenSearchUrls': Called when constructing the OpenSearch description XML. Hooks @@ -2096,13 +2096,13 @@ $parserOutput: ParserOutput resulting from rendering the page. 'OtherBlockLogLink': Get links to the block log from extensions which blocks users and/or IP addresses too. -$otherBlockLink: An array with links to other block logs +&$otherBlockLink: An array with links to other block logs $ip: The requested IP address or username 'OutputPageBeforeHTML': A page has been processed by the parser and the resulting HTML is about to be displayed. -$parserOutput: the parserOutput (object) that corresponds to the page -$text: the text that will be displayed, in HTML (string) +&$parserOutput: the parserOutput (object) that corresponds to the page +&$text: the text that will be displayed, in HTML (string) 'OutputPageBodyAttributes': Called when OutputPage::headElement is creating the body tag to allow for extensions to add attributes to the body of the page they @@ -2120,14 +2120,14 @@ since the last visit. 'OutputPageMakeCategoryLinks': Links are about to be generated for the page's categories. Implementations should return false if they generate the category links, so the default link generation is skipped. -$out: OutputPage instance (object) +&$out: OutputPage instance (object) $categories: associative array, keys are category names, values are category types ("normal" or "hidden") -$links: array, intended to hold the result. Must be an associative array with +&$links: array, intended to hold the result. Must be an associative array with category types as keys and arrays of HTML links as values. 'OutputPageParserOutput': after adding a parserOutput to $wgOut -$out: OutputPage instance (object) +&$out: OutputPage instance (object) $parserOutput: parserOutput instance being added in $out 'PageContentInsertComplete': After a new article is created. @@ -2171,7 +2171,7 @@ $status: Status object about to be returned by doEditContent() $baseRevId: the rev ID (or false) this edit was based on 'PageHistoryBeforeList': When a history page list is about to be constructed. -$article: the article that the history is loading for +&$article: the article that the history is loading for $context: RequestContext object 'PageHistoryLineEnding': Right before the end
  • is added to a history line. @@ -2189,8 +2189,8 @@ $result: a ResultWrapper representing the query result 'PageHistoryPager::getQueryInfo': when a history pager query parameter set is constructed. -$pager: the pager -$queryInfo: the query parameters +&$pager: the pager +&$queryInfo: the query parameters 'PageRenderingHash': Alter the parser cache option hash key. A parser extension which depends on user options should install this hook and append its values to @@ -2207,39 +2207,39 @@ $user: User (object) for the user who is viewing. 'ParserAfterParse': Called from Parser::parse() just after the call to Parser::internalParse() returns. -$parser: parser object -$text: text being parsed -$stripState: stripState used (object) +&$parser: parser object +&$text: text being parsed +&$stripState: stripState used (object) 'ParserAfterStrip': Called at end of parsing time. TODO: No more strip, deprecated ? -$parser: parser object -$text: text being parsed -$stripState: stripState used (object) +&$parser: parser object +&$text: text being parsed +&$stripState: stripState used (object) 'ParserAfterTidy': Called after Parser::tidy() in Parser::parse() -$parser: Parser object being used -$text: text that will be returned +&$parser: Parser object being used +&$text: text that will be returned 'ParserAfterUnstrip': Called after the first unstripGeneral() in Parser::internalParseHalfParsed() -$parser: Parser object being used -$text: text that will be returned +&$parser: Parser object being used +&$text: text that will be returned 'ParserBeforeInternalParse': Called at the beginning of Parser::internalParse(). -$parser: Parser object -$text: text to parse -$stripState: StripState instance being used +&$parser: Parser object +&$text: text to parse +&$stripState: StripState instance being used 'ParserBeforeStrip': Called at start of parsing time. TODO: No more strip, deprecated ? -$parser: parser object -$text: text being parsed -$stripState: stripState used (object) +&$parser: parser object +&$text: text being parsed +&$stripState: stripState used (object) 'ParserBeforeTidy': Called before tidy and custom tags replacements. -$parser: Parser object being used -$text: actual text +&$parser: Parser object being used +&$text: actual text 'ParserCacheSaveComplete': Called after a ParserOutput has been committed to the parser cache. @@ -2250,7 +2250,7 @@ $popts: ParserOptions used for generating $parserOutput $revId: ID of the revision that was parsed to create $parserOutput 'ParserClearState': Called at the end of Parser::clearState(). -$parser: Parser object being cleared +&$parser: Parser object being cleared 'ParserCloned': Called when the parser is cloned. $parser: Newly-cloned Parser object @@ -2260,22 +2260,22 @@ $parser: Newly-cloned Parser object 'ParserGetVariableValueSwitch': Called when the parser need the value of a custom magic word -$parser: Parser object -$varCache: array to store the value in case of multiples calls of the +&$parser: Parser object +&$varCache: array to store the value in case of multiples calls of the same magic word -$index: index (string) of the magic -$ret: value of the magic word (the hook should set it) -$frame: PPFrame object to use for expanding any template variables +&$index: index (string) of the magic +&$ret: value of the magic word (the hook should set it) +&$frame: PPFrame object to use for expanding any template variables 'ParserGetVariableValueTs': Use this to change the value of the time for the {{LOCAL...}} magic word. -$parser: Parser object -$time: actual time (timestamp) +&$parser: Parser object +&$time: actual time (timestamp) 'ParserGetVariableValueVarCache': use this to change the value of the variable cache or return false to not use it. -$parser: Parser object -$varCache: variable cache (array) +&$parser: Parser object +&$varCache: variable cache (array) 'ParserLimitReport': DEPRECATED! Use ParserLimitReportPrepare and ParserLimitReportFormat instead. @@ -2325,7 +2325,7 @@ $showEditLinks: boolean describing whether this section has an edit link 'ParserTestParser': Called when creating a new instance of Parser in tests/parser/parserTest.inc. -$parser: Parser object created +&$parser: Parser object created 'ParserTestTables': Alter the list of tables to duplicate when parser tests are run. Use when page save hooks require the presence of custom tables to ensure @@ -2398,9 +2398,9 @@ $offset: number of results to offset from the beginning 'PrefixSearchExtractNamespace': Called if core was not able to extract a namespace from the search string so that extensions can attempt it. -$namespaces: array of int namespace keys to search in (change this if you can +&$namespaces: array of int namespace keys to search in (change this if you can extract namespaces) -$search: search term (replace this with term without the namespace if you can +&$search: search term (replace this with term without the namespace if you can extract one) 'PrefsEmailAudit': Called when user changes their email address. @@ -2416,7 +2416,7 @@ $error: error (string) 'badretype', 'wrongpassword', 'error' or 'success' 'ProtectionForm::buildForm': Called after all protection type fieldsets are made in the form. $article: the title being (un)protected -$output: a string of the form HTML so far +&$output: a string of the form HTML so far 'ProtectionForm::save': Called when a protection form is submitted. $article: the Page being (un)protected @@ -2440,7 +2440,7 @@ random pages. &$text: The text that's going to be the output 'RecentChange_save': Called at the end of RecentChange::save(). -$recentChange: RecentChange object +&$recentChange: RecentChange object 'RedirectSpecialArticleRedirectParams': Lets you alter the set of parameter names such as "oldid" that are preserved when using redirecting special pages @@ -2720,8 +2720,8 @@ page output. &$tpl: QuickTemplate engine object 'SkinTemplatePreventOtherActiveTabs': Use this to prevent showing active tabs. -$sktemplate: SkinTemplate object -$res: set to true to prevent active tabs +&$sktemplate: SkinTemplate object +&$res: set to true to prevent active tabs 'SkinTemplateTabAction': Override SkinTemplate::tabAction(). You can either create your own array, or alter the parameters for @@ -2738,7 +2738,7 @@ $checkEdit: Whether or not the action=edit query should be added if appropriate. 'SkinTemplateToolboxEnd': Called by SkinTemplate skins after toolbox links have been rendered (useful for adding more). -$sk: The QuickTemplate based skin template running the hook. +&$sk: The QuickTemplate based skin template running the hook. $dummy: Called when SkinTemplateToolboxEnd is used from a BaseTemplate skin, extensions that add support for BaseTemplateToolbox should watch for this dummy parameter with "$dummy=false" in their code and return without echoing @@ -2746,7 +2746,7 @@ $dummy: Called when SkinTemplateToolboxEnd is used from a BaseTemplate skin, 'SoftwareInfo': Called by Special:Version for returning information about the software. -$software: The array of software in format 'name' => 'version'. See +&$software: The array of software in format 'name' => 'version'. See SpecialVersion::softwareInformation(). 'SpecialBlockModifyFormFields': Add more fields to Special:Block @@ -2761,27 +2761,27 @@ $sp: SpecialPage instance, providing context 'SpecialListusersDefaultQuery': Called right before the end of UsersPager::getDefaultQuery(). $pager: The UsersPager instance -$query: The query array to be returned +&$query: The query array to be returned 'SpecialListusersFormatRow': Called right before the end of UsersPager::formatRow(). -$item: HTML to be returned. Will be wrapped in
  • after the hook finishes +&$item: HTML to be returned. Will be wrapped in
  • after the hook finishes $row: Database row object 'SpecialListusersHeader': Called before closing the
    in UsersPager::getPageHeader(). $pager: The UsersPager instance -$out: The header HTML +&$out: The header HTML 'SpecialListusersHeaderForm': Called before adding the submit button in UsersPager::getPageHeader(). $pager: The UsersPager instance -$out: The header HTML +&$out: The header HTML 'SpecialListusersQueryInfo': Called right before the end of. UsersPager::getQueryInfo() $pager: The UsersPager instance -$query: The query array to be returned +&$query: The query array to be returned 'SpecialLogAddLogSearchRelations': Add log relations to the current log $type: String of the log type @@ -2789,9 +2789,9 @@ $request: WebRequest object for getting the value provided by the current user &$qc: Array for query conditions to add 'SpecialMovepageAfterMove': Called after moving a page. -$movePage: MovePageForm object -$oldTitle: old title (object) -$newTitle: new title (object) +&$movePage: MovePageForm object +&$oldTitle: old title (object) +&$newTitle: new title (object) 'SpecialNewpagesConditions': Called when building sql query for Special:NewPages. @@ -2810,7 +2810,7 @@ $special: the special page object 'SpecialPage_initList': Called when setting up SpecialPageFactory::$list, use this hook to remove a core special page or conditionally register special pages. -$list: list (array) of core special pages +&$list: list (array) of core special pages 'SpecialPageAfterExecute': Called after SpecialPage::execute. $special: the SpecialPage object @@ -2826,7 +2826,7 @@ $name: name of the special page 'SpecialPasswordResetOnSubmit': When executing a form submission on Special:PasswordReset. -$users: array of User objects. +&$users: array of User objects. $data: array of data submitted by the user &$error: string, error code (message key) used to describe to error (out parameter). The hook needs to return false when setting this, otherwise it @@ -2934,7 +2934,7 @@ $context: IContextSource object 'SpecialUploadComplete': Called after successfully uploading a file from Special:Upload. -$form: The SpecialUpload object +&$form: The SpecialUpload object 'SpecialVersionVersionUrl': Called when building the URL for Special:Version. $wgVersion: Current $wgVersion for you to use @@ -3005,7 +3005,7 @@ $title: Title object that is being checked 'TitleIsCssOrJsPage': DEPRECATED! Use ContentHandlerDefaultModelFor instead. Called when determining if a page is a CSS or JS page. $title: Title object that is being checked -$result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page. +&$result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page. Hooks may change this value to override the return value of Title::isCssOrJsPage(). @@ -3013,7 +3013,7 @@ $result: Boolean; whether MediaWiki currently thinks this is a CSS/JS page. that this hook is not called for interwiki pages or pages in immovable namespaces: for these, isMovable() always returns false. $title: Title object that is being checked -$result: Boolean; whether MediaWiki currently thinks this page is movable. +&$result: Boolean; whether MediaWiki currently thinks this page is movable. Hooks may change this value to override the return value of Title::isMovable(). @@ -3021,7 +3021,7 @@ $result: Boolean; whether MediaWiki currently thinks this page is movable. Called when determining if a page is a wikitext or should be handled by separate handler (via ArticleViewCustom). $title: Title object that is being checked -$result: Boolean; whether MediaWiki currently thinks this is a wikitext page. +&$result: Boolean; whether MediaWiki currently thinks this is a wikitext page. Hooks may change this value to override the return value of Title::isWikitextPage() @@ -3031,9 +3031,9 @@ $nt: new title $user: user who does the move 'TitleMoveComplete': After moving an article (title). -$old: old title -$nt: new title -$user: user who did the move +&$old: old title +&$nt: new title +&$user: user who did the move $pageid: database ID of the page that's been moved $redirid: database ID of the created redirect $reason: reason for the move @@ -3090,19 +3090,19 @@ $action: action name $article: article "acted on" 'UnwatchArticle': Before a watch is removed from an article. -$user: user watching -$page: WikiPage object to be removed +&$user: user watching +&$page: WikiPage object to be removed &$status: Status object to be returned if the hook returns false 'UnwatchArticleComplete': After a watch is removed from an article. $user: user that watched -$page: WikiPage object that was watched +&$page: WikiPage object that was watched 'UpdateUserMailerFormattedPageStatus': Before notification email gets sent. -$formattedPageStatus: list of valid page states +&$formattedPageStatus: list of valid page states 'UploadComplete': Upon completion of a file upload. -$uploadBase: UploadBase (or subclass) object. File can be accessed by +&$uploadBase: UploadBase (or subclass) object. File can be accessed by $uploadBase->getLocalFile(). 'UploadCreateFromRequest': When UploadBase::createFromRequest has been called. @@ -3114,16 +3114,16 @@ poke at member variables like $mUploadDescription before the file is saved. Do not use this hook to break upload processing. This will return the user to a blank form with no error message; use UploadVerification and UploadVerifyFile instead. -$form: UploadForm object +&$form: UploadForm object 'UploadForm:initial': Before the upload form is generated. You might set the member-variables $uploadFormTextTop and $uploadFormTextAfterSummary to inject text (HTML) either before or after the editform. -$form: UploadForm object +&$form: UploadForm object 'UploadFormInitDescriptor': After the descriptor for the upload form as been assembled. -$descriptor: (array) the HTMLForm descriptor +&$descriptor: (array) the HTMLForm descriptor 'UploadFormSourceDescriptors': after the standard source inputs have been added to the descriptor @@ -3150,9 +3150,9 @@ $mime: (string) The uploaded file's MIME type, as detected by MediaWiki. 'User::mailPasswordInternal': before creation and mailing of a user's new temporary password -$user: the user who sent the message out -$ip: IP of the user who sent the message out -$u: the account whose new password will be set +&$user: the user who sent the message out +&$ip: IP of the user who sent the message out +&$u: the account whose new password will be set 'UserAddGroup': Called when adding a group; return false to override stock group addition. @@ -3166,26 +3166,26 @@ $res: database result used to create the object 'userCan': To interrupt/advise the "user can do X to Y article" check. If you want to display an error message, try getUserPermissionsErrors. -$title: Title object being checked against -$user: Current user object +&$title: Title object being checked against +&$user: Current user object $action: Action being checked -$result: Pointer to result returned if hook returns false. If null is returned, +&$result: Pointer to result returned if hook returns false. If null is returned, userCan checks are continued by internal code. 'UserCanSendEmail': To override User::canSendEmail() permission check. -$user: User (object) whose permission is being checked +&$user: User (object) whose permission is being checked &$canSend: bool set on input, can override on output 'UserClearNewTalkNotification': Called when clearing the "You have new messages!" message, return false to not delete it. -$user: User (object) that will clear the message +&$user: User (object) that will clear the message $oldid: ID of the talk page revision being viewed (0 means the most recent one) 'UserCreateForm': change to manipulate the login form -$template: SimpleTemplate instance for the form +&$template: SimpleTemplate instance for the form 'UserEffectiveGroups': Called in User::getEffectiveGroups(). -$user: User to get groups for +&$user: User to get groups for &$groups: Current effective groups 'UserGetAllRights': After calculating a list of all available rights. @@ -3282,18 +3282,18 @@ $user: User object $user: User object for the logged-in user 'UserLoginComplete': After a user has logged in. -$user: the user object that was created on login -$inject_html: Any HTML to inject after the "logged in" message. +&$user: the user object that was created on login +&$inject_html: Any HTML to inject after the "logged in" message. 'UserLoginForm': change to manipulate the login form -$template: SimpleTemplate instance for the form +&$template: SimpleTemplate instance for the form 'UserLogout': Before a user logs out. -$user: the user object that is about to be logged out +&$user: the user object that is about to be logged out 'UserLogoutComplete': After a user has logged out. -$user: the user object _after_ logout (won't have name, ID, etc.) -$inject_html: Any HTML to inject after the "logged out" message. +&$user: the user object _after_ logout (won't have name, ID, etc.) +&$inject_html: Any HTML to inject after the "logged out" message. $oldName: name of the user before logout (string) 'UserMailerChangeReturnPath': Called to generate a VERP return address @@ -3303,7 +3303,7 @@ $to: Array of MailAddress objects for the recipients 'UserMailerSplitTo': Called in UserMailer::send() to give extensions a chance to split up an email with multiple the To: field into separate emails. -$to: array of MailAddress objects; unset the ones which should be mailed separately +&$to: array of MailAddress objects; unset the ones which should be mailed separately 'UserMailerTransformContent': Called in UserMailer::send() to change email contents. Extensions can block sending the email by returning false and setting $error. @@ -3343,8 +3343,8 @@ $resetKinds: array containing the kinds of preferences to reset 'UserRetrieveNewTalks': Called when retrieving "You have new messages!" message(s). -$user: user retrieving new talks messages -$talks: array of new talks page(s) +&$user: user retrieving new talks messages +&$talks: array of new talks page(s) 'UserRights': DEPRECATED! Use UserGroupsChanged instead. After a user's group memberships are changed. @@ -3392,13 +3392,13 @@ used to alter the SQL query which gets the list of wanted pages. &$query: query array, see QueryPage::getQueryInfo() for format documentation 'WatchArticle': Before a watch is added to an article. -$user: user that will watch -$page: WikiPage object to be watched +&$user: user that will watch +&$page: WikiPage object to be watched &$status: Status object to be returned if the hook returns false 'WatchArticleComplete': After a watch is added to an article. -$user: user that watched -$page: WikiPage object watched +&$user: user that watched +&$page: WikiPage object watched 'WatchlistEditorBeforeFormRender': Before building the Special:EditWatchlist form, used to manipulate the list of pages or preload data based on that list. @@ -3433,7 +3433,7 @@ run a MediaWiki cli script. 'wgQueryPages': Called when initialising list of QueryPage subclasses, use this to add new query pages to be updated with maintenance/updateSpecialPages.php. -$qp: The list of QueryPages +&$qp: The list of QueryPages 'WhatLinksHereProps': Allows annotations to be added to WhatLinksHere $row: The DB row of the entry. @@ -3464,7 +3464,7 @@ $title: The title of the page. 'XmlDumpWriterWriteRevision': Called at the end of a revision in an XML dump, to add extra metadata. -$obj: The XmlDumpWriter object. +&$obj: The XmlDumpWriter object. &$out: The text being output. $row: The database row for the revision. $text: The revision text. diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php index 4afeb0e872..f9c61c70f7 100644 --- a/maintenance/findHooks.php +++ b/maintenance/findHooks.php @@ -128,8 +128,8 @@ class FindHooks extends Maintenance { $todo = array_diff( $potential, $documented, self::$ignore ); $deprecated = array_diff( $documented, $potential, self::$ignore ); - // Check parameter count - $badParameter = array(); + // Check parameter count and references + $badParameterCount = $badParameterReference = array(); foreach ( $potentialHooks as $hook => $args ) { if ( !isset( $documentedHooks[$hook] ) ) { // Not documented, but that will also be in $todo @@ -141,7 +141,16 @@ class FindHooks extends Maintenance { continue; } if ( count( $argsDoc ) !== count( $args ) ) { - $badParameter[] = $hook . ': Doc: ' . count( $argsDoc ) . ' vs. Code: ' . count( $args ); + $badParameterCount[] = $hook . ': Doc: ' . count( $argsDoc ) . ' vs. Code: ' . count( $args ); + } else { + // Check if & is equal + foreach ( $argsDoc as $index => $argDoc ) { + $arg = $args[$index]; + if ( ( $arg[0] === '&' ) !== ( $argDoc[0] === '&' ) ) { + $badParameterReference[] = $hook . ': References different: Doc: ' . $argDoc . + ' vs. Code: ' . $arg; + } + } } } @@ -149,10 +158,11 @@ class FindHooks extends Maintenance { $this->printArray( 'Undocumented', $todo ); $this->printArray( 'Documented and not found', $deprecated ); $this->printArray( 'Unclear hook calls', $bad ); - $this->printArray( 'Different parameter count', $badParameter ); + $this->printArray( 'Different parameter count', $badParameterCount ); + $this->printArray( 'Different parameter reference', $badParameterReference ); if ( count( $todo ) == 0 && count( $deprecated ) == 0 && count( $bad ) == 0 - && count( $badParameter ) == 0 + && count( $badParameterCount ) == 0 && count( $badParameterReference ) == 0 ) { $this->output( "Looks good!\n" ); } else { -- 2.20.1