aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Hook
Commit message (Collapse)AuthorAgeFilesLines
* Namespace all remaining files in includes/filerepoJames D. Forrester2025-03-193-3/+3
| | | | | Bug: T353458 Change-Id: I35864ad9bd48701703c51367d62f8ebde963c52d
* Namespace all remaining files in includes/pageJames D. Forrester2025-03-188-8/+8
| | | | | Bug: T353458 Change-Id: I7a9c74f2106655d41ae029742090253f541bd4a6
* Clarify use of MediaWikiServices hookGergő Tisza2025-02-201-0/+12
| | | | | | | | | | | | | | | | MediaWikiServices is the only hook where global configuration settings can be safely changed; document this, and also try to clarify which services are safe to use. (The hook container service has already been created at this point, since that's what is used to run MediaWikiServices itself; and ConfigFactory does not and cannot have any dependencies. Everything else should be considered unsafe unless explicitly documented otherwise.) Bug: T286515 Bug: T288819 Change-Id: Ic0f34988cc47a06095c7cb39307e8f5602bd53e9
* Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\StatsJames D. Forrester2024-09-273-3/+3
| | | | | Bug: T353458 Change-Id: If0137003ab625017d322d57870448a02569668c3
* Add namespace to includes/api classesJames D. Forrester2024-09-251-1/+1
| | | | | Bug: T353458 Change-Id: I3ea6b08c5018ba03ba45c5766e1f46e12f6b8597
* Move Language and friends into Language namespaceJames D. Forrester2024-08-101-1/+1
| | | | | Bug: T353458 Change-Id: Id3202c0c4f4a2043bf97b7caee081acab684155c
* Move remaining four classes in includes/content into Content namespaceJames D. Forrester2024-08-104-4/+4
| | | | | Bug: T353458 Change-Id: Ia0f3e22078550be410c4b87faf6aa4eabe6e270d
* Remove deprecated Linker methodsC. Scott Ananian2024-05-151-2/+2
| | | | | | | | | | | | | The removed tests in LinkerTest were ported (or were previously ported) to the new CommentFormatter framework in the CommentParserTest class; some references to the LinkerTest class have been removed since CommentParserTest is now the canonical location for these. Cleaned up a bit more from the removed DummyLinker class as well (I69689b2037269af3320b6203fc44755f93713489). Followup-To: I69689b2037269af3320b6203fc44755f93713489 Change-Id: Ia743d13c4fe7f4e3e2bd11274895a261adbfd8e2
* Remove DummyLinkerBartosz Dziewoński2024-05-131-2/+1
| | | | | | | | | | DummyLinker existed for backwards-compatibility with a few hooks that have since been removed, e.g. 'LinkBegin'. The last hook using it is 'ImageBeforeProduceHTML', and it looks like it can be harmlessly replaced there with `null` (none of the extensions implementing the hook use this parameter). Change-Id: I69689b2037269af3320b6203fc44755f93713489
* Temporary accounts: Perform redirect for first successful editKosta Harlan2024-04-291-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: - We want to make sure that the top-level redirect fires for temporary accounts which were created in an edit attempt, but did not yet save an edit What: - In EditPage and ApiEditPage, perform the redirect if there is a saved temp user as part of the current process, or if the user account is a temporary one and it has no edits. Note that this means the top-level redirect would be performed if a temp user creates a first edit on a non-home wiki: - logged out user makes a failed attempt on wiki A, temp account is created - same user makes a successful edit on wiki A, redirect hook fires - same user visits wiki B and makes a succesful edit, redirect hook fires Note: - We could consider setting a query parameter like `createdinrequest=1` to signal to TempUserCreatedRedirect implementations that the temporary account was created in the current request, and did not exist earlier. But I am not sure if we have a use case for needing that, so have left it out of this patch. Bug: T359405 Change-Id: If4b8c561383f993606c0ba565591871195a1f8c2
* maintenance: Use expression builder in cleanupPreferences.phpUmherirrender2024-04-211-3/+4
| | | | | | | | Also type-hint for IReadableDatabase Depends-On: I15fc617eae8bc18c911525ea382e99e82b40011a Depends-On: Ib77f8f409b48115684396bf920428adb075c2820 Change-Id: I09d07ba11e8cd6d288c1ed5ddea89b654e24cbb2
* Fix misplaced EditFilterHook return value documentationTim Starling2024-02-222-5/+5
| | | | | | | | | | This return value documentation was added to hooks.txt in May 2006 (f064b66c64) for EditFilter. In December 2007 (0693d79fb6) the sections were reordered, incorrectly placing this text in the EditPage::showEditForm:initial section. This error was carried forward to the present. Change-Id: I49c01ebfada493a42ef520984e77b4deffd52d34
* Move Parser to Mediawiki\Parser namespaceSubramanya Sastry2024-02-161-1/+1
| | | | | | | | Bug: T166010 Co-Authored-By: Daimona Eaytoy <daimona.wiki@gmail.com> Co-Authored-By: James Forrester <jforrester@wikimedia.org> Co-Authored-By: Subramanya Sastry <ssastry@wikimedia.org> Change-Id: I79b4e732c45095eedbaa80afa5eb7479b387ed8a
* Move hooks used by OutputPage into includes/Output/HookC. Scott Ananian2024-02-0913-361/+0
| | | | | Bug: T166010 Change-Id: Ifdb9e6b59f126b47e4143c875c34a207643b7034
* Deprecate DummyLinkerBartosz Dziewoński2024-02-091-1/+1
| | | | | | | | | | DummyLinker existed for backwards-compatibility with a few hooks that have since been removed, e.g. 'LinkBegin'. The last hook using it is 'ImageBeforeProduceHTML', and it looks like it can be harmlessly replaced there with `null` (none of the extensions implementing the hook use this parameter). Let's try deprecating it. Change-Id: I73549afdafd681fc238e825f03bff329a65a3f47
* Namespace includes/contextJames D. Forrester2024-02-081-1/+1
| | | | | Bug: T353458 Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
* Introduce MediaWikiEntryPoint and ActionEntryPointdaniel2024-01-032-8/+14
| | | | | | | | | | | | | This extracts the MediaWikiEntryPoint base class and ActionEntryPoint class from the MediaWiki class. MediaWiki itself be deprecated. The intent is to create other subclasses of MediaWikiEntryPoint for the use by other entry points such as thumb.php or api.php. This will allow us to share code between entry points, and make these entry points testable by moving their implementation into a class. Bug: T354216 Change-Id: Ib70e4e67e4cb1b65ac218c095864fb6eb43d0929
* Namespace ParserOutputJames D. Forrester2023-12-142-2/+2
| | | | | | | Most used non-namespaced class! Bug: T353458 Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
* Remove deprecated interface ParserTestTablesHookUmherirrender2023-10-031-24/+0
| | | | | | | The hook is no longer called, so the deprecation warning of the HookContainer (as mention in DeprecatedHooks) cannot work as expected. Change-Id: Idb586e9c2d8ba87411acc137537db6d6c75485a7
* Remove deprecated class alias GetBlockErrorMessageKeyFomafix2023-10-021-6/+0
| | | | | | | Deprecated since 033e75cb2635 included in MediaWiki 1.40. Use GetBlockErrorMessageKeyHook instead. Change-Id: I346c7ec9ed7d57e3d1e1aa9f761d24e87c4ec513
* OutputPage: Fix typo in BeforePageRedirectHook docsTimo Tijhof2023-09-291-1/+1
| | | | | | Follows-up 6dacea8ec695887c512b8772bf37f269498a8125. Change-Id: I352d9c29365ab490f1679afa9e32bf193ea67015
* Clarify in inline docs how redirect URLs are expandedGergő Tisza2023-09-281-1/+1
| | | | | | | | | | | | | | | | | Also fix remark about standards. RFC 2616 required an absolute URL for the Location: header but later versions staring with RFC 7231 do not, including RFC 9110 [1] which is the version that made it to Internet Standard status; the WHATWG Fetch spec [2] also agrees. Nevertheless, there is no harm in expanding redirect URLs, and maybe improves interoperability with old clients, so don't change the logic, just adjust the comment. [1] https://datatracker.ietf.org/doc/html/rfc9110#name-location [2] https://fetch.spec.whatwg.org/#concept-response-location-url Change-Id: Ifcc2e8ae3912fa5f704ede23857e66054b1b49e4
* Namespace User under \MediaWiki\UserJames D. Forrester2023-09-198-8/+8
| | | | | Bug: T166010 Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
* Reorg: Move WebRequest to includes\RequestAmir Sarabadani2023-09-115-5/+5
| | | | | | | This has been approved as part of RFC T166010 Bug: T321882 Change-Id: I6bbdbbe6ea48cc1f50bc568bb8780fc7c5361a6f
* Reorg: Move three output related classes to includes/Output/Amir Sarabadani2023-09-0520-20/+20
| | | | | | | | | | And namesapce them: - StreamFile - OutputHandler - OutputPage Bug: T321882 Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
* Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-255-5/+5
| | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-1/+1
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* Add Hook suffix to GetBlockErrorMessageKeyHookUmherirrender2023-04-161-1/+7
| | | | | | | | | | Common naming convention for hook runner interfaces The hook is new in 1.40 and the rename should be backported, but the old name needs alias as it is already used in extensions. Bug: T334689 Change-Id: I3f9e6d33f1bf29e937c82860fcebd088dde647da
* Fix some typosMatěj Suchánek2023-03-211-1/+1
| | | | | Bug: T201491 Change-Id: I5c9408c262f09c936525f35abfacfa92a193b791
* Merge "Hook: Fix doc on CategoryViewer__generateLinkHook"jenkins-bot2023-03-021-2/+2
|\
| * Hook: Fix doc on CategoryViewer__generateLinkHookUmherirrender2023-02-281-2/+2
| | | | | | | | | | | | | | The category type is called 'file', not 'img'/image Update Linker::link as well Change-Id: Ic4b8267db006db356468afbf2290fb9a3e62df79
* | Reorg: Namespace the Title classJames D. Forrester2023-03-0232-32/+32
|/ | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* Reorg: Move EditPage.php to MediaWiki\EditPageAmir Sarabadani2023-02-1517-17/+17
| | | | | | | | Also moving TemplatesOnThisPageFormatter to the same namesapce as it's only used by EditPage Bug: T321882 Change-Id: Ibefc44eb64aedb430148b109090584c3e35794ab
* Reorg: Move DummyLinker and Linker to linker/Amir Sarabadani2022-12-081-1/+1
| | | | | | | This feels like a no-brainer unless I'm missing something obvious Bug: T321882 Change-Id: Id49c3d0dd6ea4593211048850856b5b8e05a8fb3
* Merge "HookRunner - Change PreferencesGetLayoutHook params"jenkins-bot2022-11-221-4/+7
|\
| * HookRunner - Change PreferencesGetLayoutHook paramssuecarmol2022-11-211-4/+7
| | | | | | | | | | | | | | | | | | Changed the PreferencesGetLayoutHook parameters so that it no longer passes a Skin variable. Now, the hook will pass an additional string variable with the skin name and an associative array with extra skin properties the hook might need. Bug: T322781 Change-Id: I0c4e76b528d0196ae6929fd8ed71abc6c860dfc4 Depends-On: I200aec586dbe8613e9a9c762db8d9bcbdc69a35b
* | InitializeArticleMaybeRedirect hook: Improve docs & restrictGergő Tisza2022-11-171-4/+6
|/ | | | | | | | | | | | The hook was underspecified, $article was passed by reference but it doesn't make any sense to change it and none of the existing implementations do, so clarify in the docs that it shouldn't be done and drop related logic. Also improve documentation in general. Bug: T323184 Bug: T323254 Change-Id: I53dfc7e29adcd21bb8b3ca7a1df6d88819099f3c
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-281-5/+3
| | | | | | | | | | | | | | | Redoing I5ea70120d74 but without moving WebRequest that caused issues with phan-taint-plugin. Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequestUpload Bug: T321882 Change-Id: I832b133aaf61ee9f6190b0227d2f3de99bd1717b
* Revert "Reorg: Move some of request related classes to MediaWiki/Request"Zabe2022-10-276-11/+13
| | | | | | | | | This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922. Reason for revert: T166010#8349431 Bug: T166010 Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
* Reorg: Move some of request related classes to MediaWiki/RequestAmir Sarabadani2022-10-266-13/+11
| | | | | | | | | | | | | Moving: - DerivativeRequest - FauxRequest - FauxRequestUpload - PathRouter - WebRequest - WebRequestUpload Bug: T166010 Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
* GetBlockErrorMessageKey: Add typehints and improve documentationThalia2022-10-181-1/+1
| | | | Change-Id: I8f6ec421de5bde86e7f7a830069c3dc2c05ba0b7
* Merge "Create Hook to check block's error messages from extensions"jenkins-bot2022-10-171-0/+27
|\
| * Create Hook to check block's error messages from extensionsAnaïsGueyte2022-10-141-0/+27
| | | | | | | | | | Bug: T317201 Change-Id: I1c20e7e62e0f2b453735689e3dc543164b5fd067
* | Add icons to Special:Preferences mobile layoutsuecarmol2022-10-131-0/+25
|/ | | | | | | Added icons to Special:Preferences' mobile layout sections. Also added a hook so extensions can add their own icons. Bug: T317419 Change-Id: I6d5730d47e7595b1705787995fe5db2fe734d7f5
* Redesign Special:Preferences for mobilesuecarmol2022-10-051-0/+25
| | | | | | | | | | - Added a hook that checks if the preferences should have a mobile or desktop layout - Added descriptions to preference tabs, which now display as a stack layout in mobile - Added a new mobile JS file to control Special:Preferences when in mobile view - Built the mobile interface in the preferences form Bug: T311717 Change-Id: I468481b66bf96880d1779cd11a46e18745e2c894
* TempUser CentralAuth integrationTim Starling2022-05-101-0/+38
| | | | | | | | | | | | | | | | | | | | Add a hook "TempUserCreatedRedirect" which allows an extension to modify the post-save redirect after a temporary user is created. CentralAuth will handle this hook in order to redirect to loginwiki. Loginwiki will redirect back to the page being saved. In LoginHelper::showReturnToPage add an "anchor" parameter to specify the URL fragment to redirect to. This is intended for section editing with a redirect via loginwiki. In AuthManager::autoCreateUser(), just allow any valid username, don't require it to be creatable. Previously a non-creatable username was allowed only with $source=AUTOCREATE_SOURCE_TEMP, but CentralAuth depends on user autocreation from the session during refreshCookies. The session is already validated at this point, so it's not like a user can exploit this to create arbitrary names. Change-Id: I623330dbf5d0573c93ae22f962618d6ddbd126d9
* Merge "Fix various documentation related to null types (part II)"jenkins-bot2022-03-092-3/+3
|\
| * Fix various documentation related to null types (part II)Umherirrender2022-03-082-3/+3
| | | | | | | | | | | | | | | | | | The functions returning null or the class property is set explict null. Some function should not accept null or return null. Found by phan strict checks Change-Id: Ie50f23249282cdb18caa332f562a3945a58d86ff
* | Fix various documentation related to scalar typesUmherirrender2022-03-092-2/+2
| | | | | | | | | | | | Found by phan strict checks Change-Id: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
* | Consistently use `@deprecated since` rather `@deprecated`Reedy2022-03-061-1/+1
|/ | | | Change-Id: I301786f35cd6eb9c63fb72e0b64cffa9efd7b86b