Commit graph

1244 commits

Author SHA1 Message Date
Bill Pirkle
56660af3db Update the hooks documentation included with MediaWiki.
The docs/hooks.txt file described the hook system from MediaWiki
1.34 and earlier. Its continued presence was confusing to developers,
who were not sure if they should update it. Remove the majority of
this file and direct developers to Hooks.md, which describes the
hook system implemented in 1.35. Also add a link to
https://www.mediawiki.org/wiki/Manual:Hooks to both hooks.txt and
Hooks.md.

Bug: T257804
Change-Id: I5998f179acde1a7fb1053c23305f949fa63542d9
2020-07-16 09:02:05 -05:00
Umherirrender
ae7429f878 Adjust documentation of ContributionsLineEndingHook
It is called from the ContribsPager class with $this
The type is correct, but the comment is indicating a SpecialPage object

Change-Id: I83487c288e9f0325c198eaf307ca56f65ade7eee
2020-07-12 11:20:21 +02:00
Sam Wilson
4fa7d4d7a7 Add watchlist expiry to edit form
This adds new functionality to allow non-checkbox widgets to be
used in the checkboxes row of the edit form, and adds a dropdown
widget for the watchlist-expiry field.

Bug: T248494
Change-Id: Ice5113a97b1ef97253bfa6874ea71d910a5cd8fd
2020-06-30 10:22:04 +08:00
jdlrobson
5e9604f429 Deprecate SkinTemplateOutputPageBeforeExec hook
All Wikimedia production extensions are no longer using this hook. The
hook is very generic and very dangerous per ticket and I would like to
close up future usages while we still can.

Bug: T60137
Change-Id: I294a420763e4c5a06a6692339efd28614a17d3c0
2020-06-29 15:19:55 -07:00
Roan Kattouw
c8b9d849fc Add PageMoveCompleting hook, to replace TitleMoveCompleting
We intially thought we wouldn't need this and would only need
PageMoveComplete, but it turns out Flow does need it.

Bug: T250023
Bug: T255608
Change-Id: I8e7308541d2fe6d02b9dad63e1c86c89f6e7cf53
2020-06-16 22:27:28 -07:00
Ammar Abdulhamid
dec08eacdd Deprecate SkinTemplateToolboxEnd hook
Bug: T253783
Change-Id: Ia6f46c1e3d33a14d3f3161f1716f9d0791cd397d
2020-06-15 23:18:05 +00:00
Vas Jaremchuk
cea8cd4102 Add release-notes for two deprecated hooks
SkinTemplatePreventOtherActiveTabs and SkinTemplateTabAction hooks were
deprecated in I96af224e6a6389f5f78bbe051c45fa796cd60ec0.

This patch adds deprecation notes for them in release notes and hooks.txt

Bug: T253814
Change-Id: Ic9e04872e68e4522fbb32443044a6d5aeadbd82a
2020-06-15 13:57:48 +00:00
Ammar Abdulhamid
6ef284e37e Hard deprecate BaseTemplateToolbox hook
Superseded by SidebarBeforeOutput.

Note: Translate extension is using it to serve < 1.35

Bug: T253416
Change-Id: Ia038647df14727f45f01a0923277d4d084e372af
2020-06-13 10:03:49 +01:00
Ammar Abdulhamid
aa048974db Deprecate SkinTemplateBuildNavUrlsNav_urlsAfterPermalink hook
Bug: T254431
Change-Id: I2ad144ac7aa5b0243f070b350b7dfc61ee466743
2020-06-12 22:21:13 +01:00
jenkins-bot
766d9299fb Merge "Rename MagicWordwgVariableIDs hook to GetMagicVariableIDs" 2020-06-11 02:59:19 +00:00
jenkins-bot
f34d26672e Merge "Add PageSaveComplete hook to replace PageContent(Insert|Save)Complete" 2020-06-10 21:02:49 +00:00
DannyS712
0e915c0b63 Add PageSaveComplete hook to replace PageContent(Insert|Save)Complete
Bug: T250566
Change-Id: I8e515ad9d344cb31e59bcfc87a717ca2b93feee2
2020-06-10 20:41:00 +00:00
DannyS712
1594282ad0 Replace TitleMoveCompleting and TitleMoveComplete hooks
Bug: T250023
Change-Id: Iceb0aebb51769c413bf560d1c5b70a7213cb8b91
2020-06-10 20:03:31 +00:00
C. Scott Ananian
2c9d496268 Rename MagicWordwgVariableIDs hook to GetMagicVariableIDs
This makes the hook name consistent with GetDoubleUnderscoreIDs, and
is part of a set of related documentation changes clarifying the difference
between "magic words" (a localization infrastructure) and the various
functions which use magic words for localization, such as parser functions,
double underscore variables, magic variables, etc.

See also I621c888e3790a145ca9978f6b30ff1a8f685b64c.

Change-Id: Ie2a6df4b179a360fb7cdfb219e915bedff501d1d
2020-06-10 12:28:20 -04:00
mainframe98
4e2897575a Replace BaseTemplateAfterPortlet with SkinAfterPortlet
BaseTemplate should not handle anything but rendering.
In order to allow replacing it with another renderer,
such as Mustache or Vue, its hooks should be moved to
the Skin class instead.

BaseTemplateAfterPortlet is soft deprecated to allow
filtering, preventing the hook from running twice.

Both BaseTemplate::getAfterPortlet and ::renderAfterPortlet
have been deprecated as well, with both now calling
Skin::getAfterPortlet after running the
BaseTemplateAfterPortlet hook.

Bug: T253797
Change-Id: I438daa79d3d97e2518e6258c3213a805bd1f30e8
2020-06-09 21:51:58 +00:00
jenkins-bot
18ec60d147 Merge "Un-deprecate the ParserPreSaveTransformComplete hook" 2020-06-04 22:03:55 +00:00
jenkins-bot
3cd87b81cf Merge "Documentation for the new hook system" 2020-06-01 15:54:13 +00:00
C. Scott Ananian
13d0ad0de6 Un-deprecate the ParserPreSaveTransformComplete hook
Although it's true that Parsoid doesn't (yet) support this hook, and
the $parser object referenced in the hook is likely going to be changed,
this is a hook added in 1.35 (eb6c5f70d9)
to replace use of an even worse hook.  So let's keep the lesser of the
evils, at least for now.

Bug: T236809
Change-Id: I8f866c3b9f1fc51848cfe9364635112371d18e3e
2020-06-01 10:14:39 -04:00
jenkins-bot
e4fb04a5f0 Merge "Make hook parameters use consistent name as the Hook interface" 2020-05-30 10:07:48 +00:00
Ammar Abdulhamid
7c1a46ba88 Make hook parameters use consistent name as the Hook interface
Param 'bar' was renamed to more descriptive 'sidebar' in the interface. The change should be reflected here.

Change-Id: Icdb57a4f801272d408161503d330f3260291c579
2020-05-29 13:24:17 +01:00
DannyS712
0eb1de24a7 UserClearNewTalkNotification hook: Only guarantee a UserIdentity
Bug: T253435
Change-Id: Ia46b67ff284a8b9bc0d500e7b8536c2e84faef61
2020-05-29 09:40:31 +00:00
Tim Starling
323ac073d3 Documentation for the new hook system
Add Hooks.md with a description of the new hooks system

Bug: T240307
Change-Id: I83cbbfc52ba7645ee5f31b6bcc0cb23cd1bf1ccf
2020-05-28 00:58:11 +00:00
Petr Pchelko
82bf390ed5 Add $originalOptions parameter to UserSaveOptions hook
Since the hook interfaces are not yet released and adding a parameter
to the hook is b/c, I have just added a parameter without introducing
a new version of the hook interface

Bug: T253149
Change-Id: Iac6c4b706ddbc7b0c9fb0b40eba05bd3530b1fdf
2020-05-27 08:32:40 -07:00
MarcoAurelio
dbfebbbcec Fix typo 'desciption'
Should be 'description'.

Bug: T201491
Change-Id: Ic6d7efb8da2fb1c9645ca4c4e666d10953b8a4ab
2020-05-21 18:42:35 +00:00
jenkins-bot
6ca9c1f252 Merge "Replace NewRevisionFromEditComplete with RevisionFromEditComplete" 2020-05-14 00:22:57 +00:00
James D. Forrester
4363a7406f resourceloader: Document replacement for the ResourceLoaderTestModules hook
Bug: T232875
Change-Id: Id30e1e552df43a3237deeaf25ad181d7bf1944ef
2020-05-11 18:56:27 +00:00
DannyS712
77e2dd7169 Replace NewRevisionFromEditComplete with RevisionFromEditComplete
Bug: T250338
Change-Id: I4ef249d013d1a9bc33d1d0f380c41963635012ab
2020-05-11 15:09:25 +00:00
Petr Pchelko
c2a1e0f7e5 Create TalkPageNotificationManager service
* The hook that's being deprecated is not used anywhere
in MW ecosystem.
* The getNewMessageLinks/getNewMessageRevisionId wasn't
ported to the service, only the DB lookup. The interface
of these two methods is extremelly weird, the idea is that
they should eventually be able to do cross-wiki lookups.
This doesn't belong in the service - with only a single caller,
these methods should be moved out of User and inlined into the
caller instead.
* There's been a little bit of preparation done to T146585#4233276
as the interface of setNewTalk was split into set and remove
with the idea that we gotta require Revision to be passed to
setUserHasNewMessages eventually. B/C is still maintained though
since service-conversion patches are not a right place for making
behavioural changes
* The tests are only integration tests since most of the logic
in the manager is tied up to the database anyway.

Bug: T239640
Change-Id: Ia0a52865970c11066d1089196251f62ffeaa53bb
2020-05-06 15:31:55 -07:00
Peter Ovchyn
7df7b923da rest: Add 'thumbnail' and 'description' fields to the search response
By default, core adds those fields as null to each row.
provideThumbnail and provideDescription hooks are introduced.
Extension should subscribe on the hooks to provide a thumbnail and description respectively.

Bug: T250144
Change-Id: I42c6c8ff9d887a440174af2a21c7921573b06640
2020-05-05 19:35:52 +03:00
Tim Starling
2bcabb0dee Add $conds parameter to ModifyExportDisplayQuery hook
Since I8d825eb02c69cc66d90bd41325133fd3f99f0226, modification of the
$cond parameter to the ModifyExportDisplayQuery hook has had no effect,
since $cond is now incorporated into a condition array $conds. This
seems contrary to the purpose of the hook, although no extension in
CodeSearch actually depends on it.

It was also a documentation error, with the incorrect type on the
interface causing a Phan error in the HookRunner call site migration
patch.

So, add a $conds parameter to the hook, which allows modification of
the array, and fix the documentation.

Change-Id: Id4608cec35df56456d7dad4de107bbef816e964b
2020-05-05 11:22:04 +10:00
DannyS712
b361cf7239 Update hook interfaces for recent additions and deprecations
Changes since the interfaces were generated:
5 hooks added:
* RevisionUndeleted
* ParserBeforePreprocess
* RollbackComplete
* HtmlCacheUpdaterAppendUrls
* HtmlCacheUpdaterVaryUrls

9 hooks deprecated:
* ArticleRevisionUndeleted
* ArticleRollbackComplete (soft deprecation)
* UndeleteShowRevision
* InternalParseBeforeSanitize
* ParserFetchTemplate
* ParserSectionCreate
* ParserPreSaveTransformComplete
* BeforeParserrenderImageGallery
* ParserBeforeTidy

Bug: T240307
Change-Id: Ib91b1d8e519e6cb3c74a6fe174fe2fd0103d6d30
2020-05-05 11:22:04 +10:00
DannyS712
e5066d0bbf Hooks.txt - remove two Localisation hooks that have no callers
LocalisationChecksBlacklist and LocalisationIgnoredOptionalMessages
were removed, update hooks.txt

Change-Id: Ia2dc083a70bf5a7e0c121702cc09ace5bbb2b817
2020-05-04 07:06:34 +00:00
jenkins-bot
e2d7f9b490 Merge "Hard deprecate $wgParser" 2020-05-01 21:31:26 +00:00
Timo Tijhof
2f35c3ae67 HtmlCacheUpdater: Add getUrls() method and support selective purging
* Move the Title::getCdnUrls() logic to the new HtmlCacheUpdater service.

* Introduce a runtime option to decide whether this is for a direct
  revision or a cascading LinksUpdate.

Bug: T250261
Change-Id: I514b9052761e0d949234996e97fdef255582df86
2020-04-30 18:16:07 +00:00
TheSandDoctor
705e7e7c21 Hard deprecate $wgParser
$wgParser, originally soft deprecated in 1.32, has been hard deprecated.

Code search in WMF deployed code:
https://codesearch.wmflabs.org/deployed/?q=%5B%24%5DwgParser%5B%5EA-Z%5D&i=nope&files=&repos=

Everything search:
https://codesearch.wmflabs.org/search/?q=%5B%24%5DwgParser%5B%5EA-Z%5D&i=nope&files=&repos=

Bug: T160811
Change-Id: I6830126d4dedab25b6ae6a2fcbfacdf429f71021
2020-04-30 03:41:04 -04:00
Tim Starling
df65f09669 Revert "Correct capitalization of BeforeParserFetchTemplateAndTitle hook"
In the new hook system, it is invalid to have two hooks that differ only
in case.

This reverts commit afb5b38e15.

Change-Id: I160ece0a7bc68c748037b383137364b787be86a0
2020-04-30 07:50:24 +10:00
jenkins-bot
4ca946e155 Merge "Replace ArticleRollbackComplete hook with RollbackComplete" 2020-04-20 22:58:57 +00:00
DannyS712
1519cefbc4 Replace ArticleRollbackComplete hook with RollbackComplete
Bug: T250543
Change-Id: I5fcb4b2adad8f16811bf9c76b95378f0f0f1e6a6
2020-04-18 04:54:48 +00:00
C. Scott Ananian
b328aa3311 Add ParserBeforePreprocess hook
This will allow us to deprecate the ParserBeforeStrip and ParserAfterStrip
hooks by covering the one case where ParserBeforeStrip is called but
ParserBeforeInternalParse is not.

Bug: T250450
Change-Id: Ia298fecba77e97fc30dc30a09ac69a4239767d8c
2020-04-17 17:20:22 -04:00
C. Scott Ananian
95350d3dcf Deprecate ParserBeforeTidy hook
Untidy parser output should not be exposed outside mediawiki core.
Callers should use ParserAfterTidy instead.

Code search:
https://codesearch.wmflabs.org/deployed/?q=ParserBeforeTidy&i=nope&files=&repos=
https://codesearch.wmflabs.org/search/?q=ParserBeforeTidy&i=nope&files=&repos=

Depends-On: Ia6bd94fc937a9bff77843e6734e88ba8991d04ec
Change-Id: I4a0aae7b17fb522a5e4f90edad3a0b7137b270a6
2020-04-17 17:20:20 -04:00
C. Scott Ananian
afb5b38e15 Correct capitalization of BeforeParserFetchTemplateAndTitle hook
We deprecate the incorrect capitalization and add a new hook with the
correct capitalization.  There are very few users of this hook, and none
in WMF-deployed code.

WMF-deployed code search:
https://codesearch.wmflabs.org/deployed/?q=BeforeParserFetchTemplateAndtitle&i=nope&files=&repos=

Everything code search:
https://codesearch.wmflabs.org/search/?q=BeforeParserFetchTemplateAndtitle&i=nope&files=&repos=

It would be tempting to remove this hook entirely, but it seems to
serve a valuable purpose in allowing page and template fetches at a
specific "old" timestamp.  (Extension:Memento and Extension:TimeTravel
don't seem to have implemented this feature, however.)

Change-Id: I501b0ee35b81fee424d45084088a6ed63c3dfd54
2020-04-17 17:19:44 -04:00
C. Scott Ananian
d8bb54a965 Deprecate infrequently-used parser-related hooks
The following parser-related hooks have no users in deployed code:
- InternalParseBeforeSanitize
- ParserFetchTemplate
- ParserSectionCreate
- ParserPreSaveTransformComplete
- BeforeParserrenderImageGallery

Code search in WMF-deployed code:
https://codesearch.wmflabs.org/deployed/?q=%5Cb%28InternalParseBeforeSanitize%7CParserFetchTemplate%7CParserSectionCreate%7CParserPreSaveTransformComplete%7CBeforeParserrenderImageGallery%29%5Cb&i=nope&files=&repos=

Code search in all code:
https://codesearch.wmflabs.org/search/?q=%5Cb%28InternalParseBeforeSanitize%7CParserFetchTemplate%7CParserSectionCreate%7CParserPreSaveTransformComplete%7CBeforeParserrenderImageGallery%29%5Cb&i=nope&files=&repos=

Removing as many infrequently-used hooks as possible will aid our
transition from the legacy parser to alternative parsers.

Bug: T236809
Change-Id: I3a09fbe6436232ae0b417ad61b19f8df6d0485e0
2020-04-17 17:18:01 -04:00
DannyS712
5127acb8ec RevisionUndeleted hook: Add $oldPageId
Not always the same as the restored revision's pageId

Bug: T248727
Change-Id: I4e3ea4519d34de7c67ad8999575affe77d756f08
2020-04-14 23:08:54 +00:00
C. Scott Ananian
83a22b7fcd Remove codepaths which ran parser in 'untidy' mode
Disabling tidy has been deprecated since 1.33.  This cleans up the code
paths which still used untidy output.

Bug: T198214
Change-Id: I821ef3b8f59b272d983583d407b2f0794fe1e791
2020-04-13 21:34:04 +00:00
DannyS712
d4c08de41b Deprecate the UndeleteShowRevision hook
No known uses; if needed, can be reintroduced with RevisionRecord

Bug: T249434
Change-Id: I5c50a13c98145f3cddde2e817ac29ebb27c9cc73
2020-04-13 04:43:55 +00:00
DannyS712
c2ff5c0355 Add RevisionUndeleted hook to replace ArticleRevisionUndeleted
Bug: T248727
Change-Id: Ic4f771fcb3f1468a78b7eef3ff11686083144154
2020-04-08 12:26:36 +00:00
jenkins-bot
65906da2c2 Merge "MCR: provide MultiContentSave hook to replace PageContentSave" 2020-03-30 17:09:45 +00:00
Edward Chernenko
9cf8427865 MCR: provide MultiContentSave hook to replace PageContentSave
Old hook PageContentSave only received the main slot of the article.
In order for extensions to intercept changes in all slots, they should
receive a RevisionSlots object with new content.

PageContentSave hook is still preserved for backward compatibility.

Note: parameters $iswatch and $section (from PageContentSave) are
not added into the new hook, because they are obsolete in the old hook.

Note: new hook also doesn't unnecessarily pass-by-reference (T193950),
which was an issue with the old hook.

Bug: T205982
Change-Id: I55455639c5ff6ccbf3917d85c1ab0dac847ec853
2020-03-27 23:06:33 +03:00
C. Scott Ananian
a3c9621ad0 Deprecate unusual uses of the ParserGetVariableValueSwitch hook
Ensure that the value returned is always also added to the cache, since
we (eventually) want to remove the hook's access to
$parser->mVarCache.  Also don't allow monkeying with the value passed
as $magicWordId, even though it's a reference.

Code search:
https://codesearch.wmflabs.org/deployed/?q=ParserGetVariableValueSwitch&i=nope&files=&repos=

Bug: T236813
Depends-On: Ia12faefada7e4cf04f1a6b12b3ed1703bf28e437
Depends-On: Ia9e2e00c6b7d0e62cbe80c3b124165b691b1ff3d
Depends-On: I1e48fa47b8723958d543a69aaf9b62b872200dc5
Depends-On: If9a0885a8664c22473ade712364c2dd0a5c04e0b
Change-Id: I3d6b281f8e4e0bf68eefbf9767047527b4573b79
2020-03-27 08:59:21 -04:00
C. Scott Ananian
99f6b82995 Deprecate the ParserGetVariableValueVarCache hook
We don't want to expose the internal caching mechanism of the parser.
There are no uses in deployed WMF code:

https://codesearch.wmflabs.org/deployed/?q=ParserGetVariableValueVarCache&i=nope&files=&repos=

Bug: T236813
Change-Id: I1b0a5cf7d32be86a45d7231940360e2bfce7275f
2020-03-26 18:47:30 -04:00