In hooks.txt, annotate all parameters that are references for legacy reasons with [&] instead of &. This will be the canonical source of this information. After T240307 is complete, assignment through the reference (replacement) will have no effect. So if any parameters are incorrectly annotated with [&], extensions will break. These changes are final, since T240307 will make it impossible to change the reference type of an existing hook. The only recourse will be add a new hook without the reference. Full review notes: * FileDeleteComplete: A case of inappropriate non-object references introduced by analogy: the local variables are not consulted after the hook is called. CodeSearch reveals that handlers already use non-ref params, presumably due to T193950 * BeforeInitialize: Replacing the title here would have some effect, but it is fetched from the context and not written back, so the result would be inconsistent. Inadvisable. * InitializeArticleMaybeRedirect: $target and $article are certainly replaceable, but not the request-sourced variables $title and $request. The correct way to redirect is to use $target. * IsTrustedProxy: $ip inappropriate scalar reference * ResourceLoaderRegisterModules: The contract is pretty clear here, replacement would be difficult * ActionBeforeFormDisplay: replacement seems inadvisable; no handlers in codesearch * PageHistoryBeforeList: inadvisable, no callers replace * UnwatchArticleComplete: $user was called with & but undocumented * APIAfterExecute: seems safe from codesearch * APIQueryGeneratorAfterExecute: no handlers * User::mailPasswordInternal: handlers do not use ref params * FetchChangesList: replacement would have no effect * ParserFirstCallInit, ParserClearState, ParserBeforeStrip, ParserAfterStrip, ParserAfterParse, ParserBeforeInternalParse, InternalParseBeforeSanitize, InternalParseBeforeLinks, ParserBeforeTidy, ParserAfterTidy, ParserGetVariableValueVarCache, ParserGetVariableValueTs, ParserGetVariableValueSwitch, BeforeParserrenderImageGallery: undocumented reference * BeforeParserrenderImageGallery: replacement seems inadvisable after mutation. No handlers. * RevisionInsertComplete: undocumented reference * SkinTemplateOutputPageBeforeExec: $tpl replacement would be inadvisable after mutation. CodeSearch shows many callers, I haven't reviewed them all, but a sampling shows $tpl->set() being the usual pattern * SpecialPageBeforeFormDisplay: CodeSearch confirms this is harmless * BlockIp: did CodeSearch to confirm that neither variable is replaced * SpecialMovepageAfterMove: did CodeSearch * UnblockUser: no handlers * UndeleteForm::showRevision: extensions/Video actually tries to replace it, but forgot to declare the parameter as a reference. Filed T246408. * ArticleEditUpdates: $editInfo is unused after the hook call * PageContentSave: undocumented ref params. $mainContent is unused after hook call. * ImageBeforeProduceHTML: $dummy is unused after hook execution. The rest could be altered Bug: T193950 Change-Id: I6ddf54cb6812d2e292eca6d8e588364498c2fe73 |
||
|---|---|---|
| .. | ||
| databases | ||
| html | ||
| php-memcached | ||
| uidesign | ||
| contenthandler.md | ||
| database.md | ||
| deferred.txt | ||
| distributors.txt | ||
| export-0.1.xsd | ||
| export-0.2.xsd | ||
| export-0.3.xsd | ||
| export-0.4.xsd | ||
| export-0.5.xsd | ||
| export-0.6.xsd | ||
| export-0.7.xsd | ||
| export-0.8.xsd | ||
| export-0.9.xsd | ||
| export-0.10.xsd | ||
| export-0.11.xsd | ||
| export-demo.xml | ||
| extension.schema.v1.json | ||
| extension.schema.v2.json | ||
| globals.txt | ||
| hooks.txt | ||
| Injection.md | ||
| Introduction.md | ||
| Language.md | ||
| LinkCache.md | ||
| Logger.md | ||
| magicword.md | ||
| maintenance.txt | ||
| memcached.md | ||
| ontology.owl | ||
| pageupdater.md | ||
| README | ||
| schema.md | ||
| sitelist-1.0.xsd | ||
| sitelist.md | ||
| Skin.md | ||
| Title.md | ||
/docs Directory README ====================== The 'docs' directory contain various text files that should help you understand the most important parts of the code of MediaWiki. More in-depth documentation can be found at: https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Code https://www.mediawiki.org/wiki/Special:MyLanguage/Developer_hub API documentation is automatically generated and updated daily at: https://doc.wikimedia.org/mediawiki-core/master/php/html/ You can get a fresh version using 'make doc' or mwdocgen.php in the ../maintenance/ directory. For end users, most of the documentation is located online at: https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Contents Documentation for MediaWiki site administrators is at: https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Contents