Umherirrender has uploaded a new change for review.
https://gerrit.wikimedia.org/r/246306
Change subject: Allow findHooks.php to compare parameter references of hooks
......................................................................
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
---
M docs/hooks.txt
M maintenance/findHooks.php
2 files changed, 224 insertions(+), 205 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/06/246306/1
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 5299b0c..9d079f8 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -245,7 +245,7 @@
'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 @@
$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 @@
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 @@
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 @@
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 @@
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 @@
'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 @@
$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)
'ArticleDeleteAfterSuccess': Output after an article has been deleted.
@@ -581,8 +581,8 @@
$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
@@ -595,19 +595,19 @@
'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.
@@ -627,34 +627,34 @@
$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)
@@ -694,7 +694,7 @@
$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.
@@ -707,7 +707,7 @@
'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
@@ -733,7 +733,7 @@
'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.
@@ -747,7 +747,7 @@
$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.
@@ -795,7 +795,7 @@
'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
@@ -851,8 +851,8 @@
&$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.
@@ -890,7 +890,7 @@
$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
@@ -1069,7 +1069,7 @@
$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
@@ -1101,8 +1101,8 @@
'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
@@ -1172,16 +1172,16 @@
'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.
@@ -1266,21 +1266,21 @@
'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
@@ -1289,7 +1289,7 @@
$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.
@@ -1342,12 +1342,12 @@
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
@@ -1388,11 +1388,11 @@
'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
@@ -1401,8 +1401,8 @@
'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.
@@ -1438,8 +1438,8 @@
&$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
@@ -1452,8 +1452,8 @@
$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).
@@ -1469,17 +1469,17 @@
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()
@@ -1524,10 +1524,10 @@
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
@@ -1536,10 +1536,10 @@
param2, ... ). 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.
@@ -1570,8 +1570,8 @@
'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.
@@ -1615,7 +1615,7 @@
'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
@@ -1642,11 +1642,11 @@
&$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.
@@ -1679,11 +1679,11 @@
$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
@@ -1706,7 +1706,7 @@
'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
@@ -1717,7 +1717,7 @@
'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.
@@ -1811,15 +1811,15 @@
&$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
@@ -1937,7 +1937,7 @@
&$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.
@@ -1953,13 +1953,13 @@
'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.
'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.
@@ -1986,7 +1986,7 @@
'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.
@@ -2036,7 +2036,7 @@
'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().
@@ -2069,7 +2069,7 @@
return false to omit the line from RecentChanges and Watchlist special pages.
&$changeslist: The OldChangesList instance.
&$s: HTML of the form "<li>...</li>" containing one RC entry.
-&$rc: The RecentChange object.
+$rc: The RecentChange object.
&$classes: array of css classes for the <li> element
'OpenSearchUrls': Called when constructing the OpenSearch description XML.
Hooks
@@ -2089,13 +2089,13 @@
'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
@@ -2113,14 +2113,14 @@
'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.
@@ -2164,7 +2164,7 @@
$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 <li> is added to a history line.
@@ -2182,8 +2182,8 @@
'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
@@ -2200,39 +2200,39 @@
'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.
@@ -2243,7 +2243,7 @@
$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
@@ -2253,22 +2253,22 @@
'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.
@@ -2318,7 +2318,7 @@
'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
@@ -2391,9 +2391,9 @@
'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.
@@ -2409,7 +2409,7 @@
'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
@@ -2433,7 +2433,7 @@
&$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
@@ -2712,8 +2712,8 @@
&$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
@@ -2730,7 +2730,7 @@
'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
@@ -2738,7 +2738,7 @@
'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
@@ -2753,27 +2753,27 @@
'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 <li></li> after the hook
finishes
+&$item: HTML to be returned. Will be wrapped in <li></li> after the hook
finishes
$row: Database row object
'SpecialListusersHeader': Called before closing the <fieldset> 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
@@ -2781,9 +2781,9 @@
&$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.
@@ -2802,7 +2802,7 @@
'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
@@ -2818,7 +2818,7 @@
'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
@@ -2926,7 +2926,7 @@
'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
@@ -2997,7 +2997,7 @@
'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().
@@ -3005,7 +3005,7 @@
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().
@@ -3013,7 +3013,7 @@
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()
@@ -3023,9 +3023,9 @@
$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
@@ -3082,19 +3082,19 @@
$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.
@@ -3106,16 +3106,16 @@
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
@@ -3142,9 +3142,9 @@
'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.
@@ -3158,26 +3158,26 @@
'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.
@@ -3274,18 +3274,18 @@
$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
@@ -3295,7 +3295,7 @@
'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.
@@ -3335,8 +3335,8 @@
'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.
@@ -3384,13 +3384,13 @@
&$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.
@@ -3425,7 +3425,7 @@
'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.
@@ -3456,7 +3456,7 @@
'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 38bff00..a8af9cb 100644
--- a/maintenance/findHooks.php
+++ b/maintenance/findHooks.php
@@ -128,8 +128,8 @@
$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,25 @@
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 ( preg_match(
'/^&?(?:self::)?\$\w+/', $arg ) ) {
+ // $arg is a variable, compare
+ if ( strncmp( $argDoc, $arg, 1
) !== 0 ) {
+
$badParameterReference[] = $hook . ': References different: Doc: ' . $argDoc .
+ ' vs. Code: ' .
$arg;
+ }
+ } else {
+ // $arg is a fixed value or
expression, no & possible
+ if ( $argDoc[0] !== '$' ) {
+
$badParameterReference[] = $hook . ': References different: Doc: ' . $argDoc .
+ ' vs. Code
value: ' . $arg;
+ }
+ }
+ }
}
}
@@ -149,10 +167,11 @@
$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 {
--
To view, visit https://gerrit.wikimedia.org/r/246306
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b45253e20dc310e825cdc17e0e2e9c8fb315bab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits