Commit graph

1823 commits

Author SHA1 Message Date
jenkins-bot
18ec60d147 Merge "Un-deprecate the ParserPreSaveTransformComplete hook" 2020-06-04 22:03:55 +00:00
Tim Starling
d1363015b7 Introduce soft deprecation of hooks
Add a "silent" flag to DeprecatedHooks which causes relevant deprecation
warnings to be suppressed, but still allows call filtering to be used.

Add existing hooks that are documented as deprecated to the array.

Change-Id: Ieeb5e1840fd06d2b7979ef7827ba82bd2a35a2ba
2020-06-04 10:00:55 +10:00
Volker E
366768e905 mediawiki.diff: Reduce selectors and remove obsolete documentation HTML page
Reinstate `ins`/`del` selectors of I5db0350bca0b8c32 and remove obsolete
'uidesign' doc page that was building on top of CSS file.

Change-Id: Id48c076e6429c0066078c691fe99f06317e14b8a
2020-06-03 21:46:43 +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
jenkins-bot
ca6ec5a4ee Merge "Add 'ParsoidModules' as a top-level core attribute in extension.json" 2020-05-29 00:16:01 +00:00
DannyS712
e55e19c630 Injection.md - document ServiceOptions/CONSTRUCTOR_OPTIONS systems
Common way of injecting multiple configuration values

Change-Id: Ie7f7febf279baf34bad8b628911285bca3a008b5
2020-05-28 22:19:59 +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
jenkins-bot
b5012a1e7d Merge "[registration] Remove type of string from Hooks in extension.schema.v1.json" 2020-05-26 16:25:11 +00:00
jenkins-bot
29fbda6260 Merge "Extension schema updates for HookContainer" 2020-05-26 00:46:33 +00:00
Reedy
583602e16d [registration] Remove type of string from Hooks in extension.schema.v1.json
Same as it will be or v2 when that patch merges

Change-Id: I64c3bbcda0f353fe9c14b0d5bea241e0304c0e2e
Follows-Up: I1a8657ff9fd14618c6709dbab62c3b4ee9f659a5
2020-05-26 01:28:49 +01:00
jenkins-bot
d1e2be2b43 Merge "docs/README: Update link to php documentation on doc.wikimedia.org" 2020-05-25 09:32:16 +00:00
DannyS712
8f92469c6c docs - minor cleanup, including fixing markdown syntax
Use code highlighting where relevant
Fix list syntax in memcached.md to render lists without paragraph breaks
Add a missing period to schema.md

Change-Id: I763cfd479968cedbf952c231283d33b82a0910d6
2020-05-23 07:58:14 +00:00
DannyS712
74a7ebce44 docs/README: Update link to php documentation on doc.wikimedia.org
https://doc.wikimedia.org/mediawiki-core/master/php/html/ no longer
works, https://doc.wikimedia.org/mediawiki-core/master/php/ is where
the php documentation lies

Change-Id: I518027861ea60bcee66e6c0fb50cc4dabef714f0
2020-05-23 07:46:33 +00:00
C. Scott Ananian
e71e025aba Add 'ParsoidModules' as a top-level core attribute in extension.json
See also I20f641a1ff032a6da3549b01dfaf8f4cf1eb5071, which uses this
attribute, and the earlier discussion in the (abandoned)
Ia251d631febf5be7fcad21cd8b73a68ec2785137.

Bug: T133320
Change-Id: I6c74938883376ec17f3790678b435585083a440f
2020-05-22 18:19:00 +00:00
MarcoAurelio
dbfebbbcec Fix typo 'desciption'
Should be 'description'.

Bug: T201491
Change-Id: Ic6d7efb8da2fb1c9645ca4c4e666d10953b8a4ab
2020-05-21 18:42:35 +00:00
Tim Starling
7abd828ea3 Extension schema updates for HookContainer
* Updated the extension schema for the new hook system
* Fixed the lack of "services" from RestRoutes ObjectFactory specs,
  since RestRoutes and HookHandlers is supposed to be the same.

Bug: T240307
Change-Id: I1a8657ff9fd14618c6709dbab62c3b4ee9f659a5
2020-05-18 14:18:35 +10:00
jenkins-bot
1eaf12a4d6 Merge "Update PostgreSQL supported version in docs/database/postgres.txt" 2020-05-17 16:32:51 +00:00
Reedy
39176163d2 Update PostgreSQL supported version in docs/database/postgres.txt
Change-Id: I9e49857e67f3351683dbbf0019d8301eaf43e59c
2020-05-17 15:43:46 +01:00
Reedy
71c3aaf7f7 Remove rotten docs/php-memcached docs
README contains a URL that doesn't work.

ChangeLog has no purpose these days

Documentation doesn't match state of the class these days either

Change-Id: Ia2e00891d78cb4b227113e89d6b5e95a10261f0a
2020-05-17 15:42:17 +01:00
jenkins-bot
b7968e948d Merge "Sync descriptions from extension.schema.v2.json to v1.json" 2020-05-16 02:44:20 +00:00
Reedy
0b91ceedec Sync descriptions from extension.schema.v2.json to v1.json
Change-Id: I2acb39f4544e2608596f8e76e10ddc516309edec
2020-05-16 03:06:19 +01:00
Reedy
1b1a17bcef skins: Allow $wgValidSkinNames to take ObjectFactory spec
Bug: T252760
Change-Id: I189de448c3b2c56dfe6bf49170d7746943cf2417
2020-05-16 01:57:25 +00:00
jenkins-bot
6ca9c1f252 Merge "Replace NewRevisionFromEditComplete with RevisionFromEditComplete" 2020-05-14 00:22:57 +00:00
Kunal Mehta
e3d8971bef registration: Restrict properties in "config" in manifest_version 2
This allows for the schema to spot typos because there's now a whitelist of
properties. The main thing that might get caught by this is documentation
using "@something" keys, but all of that should be under "description"
now.

I sent patches to all extensions/skins in Gerrit so they'll pass validation
with the new schema: <https://gerrit.wikimedia.org/r/q/topic:%22fix-config-validation%22>.

Bug: T252589
Change-Id: I94d96b8a66b9209fa32726c2a2166308536f6c8a
2020-05-12 13:02:06 -07: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
8829ce7973 Merge "registration: Move SearchMappings to CORE_ATTRIBS from NOT_ATTRIBS" 2020-05-02 18:45:50 +00:00
James D. Forrester
385ab8870e Finish dropping wgContentHandlerUseDB; unused anywhere
Change-Id: I89ac9f43005975403225b43099561d3b6f147361
2020-05-01 17:11:22 -07:00
jenkins-bot
e2d7f9b490 Merge "Hard deprecate $wgParser" 2020-05-01 21:31:26 +00:00
Reedy
aed1e72c96 registration: Move SearchMappings to CORE_ATTRIBS from NOT_ATTRIBS
Also remove SearchMappings from extension.v1.json

Bug: T250977
Change-Id: I010ac37a869ad12c4dcbe65805a19ee0662a34e3
Follows-Up: Ib9634128f07d428276e80a6f2f492b850eef17e8
2020-05-01 18:23:12 +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
jenkins-bot
dab27d410b Merge "search: Add 'SearchMappings' attribute to map canonical name to PHP class" 2020-04-30 10:05:31 +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
Reedy
eeb8cb1342 search: Add 'SearchMappings' attribute to map canonical name to PHP class
This allows indirection between the values in $wgSearchType and
$wgSearchTypeAlternatives where the underlying class name
doesn't match the actual class name that subclasses
SearchEngine.

Bug: T250977
Change-Id: Ib9634128f07d428276e80a6f2f492b850eef17e8
2020-04-30 04:29:17 +00: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
Reedy
b0ef0b3717 Clarifiy that (extension|skin).json requires properties can be for skins too
Change-Id: I61f92dee4092ea2644f1d93eeaf7b03a6ef2308d
2020-04-22 15:50:30 +01:00
jenkins-bot
4ca946e155 Merge "Replace ArticleRollbackComplete hook with RollbackComplete" 2020-04-20 22:58:57 +00:00
Holger Knust
0e70b9f974 docs: Restore welcome message on docs landing page
Restored mark up in Introduction.md to have Doxygen create the welcome page in docs.

Bug: T248706
Change-Id: Idfd2b13367428d6747bd79eac0f8e0e3980b13cd
2020-04-20 09:22:00 -04: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
C. Scott Ananian
75c5176b36 Typo fix: 'depencency' -> 'dependency'
Change-Id: I90712b2bdc819cad20c93a4ce3de8b9af9d7d14c
2020-04-09 14:02:53 -04: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
jenkins-bot
1f2aa3390a Merge "Setup.php: Remove internal $messageMemc variable" 2020-03-22 01:52:39 +00:00
Daimona Eaytoy
c1d6e8b0b9 page: Remove the ArticleAfterFetchContentObject hook
Deprecated since 1.32, and no longer used anywhere.
It is referenced in ApprovedRevs, but conditional on a MW < 1.35
context only.


Change-Id: I415927f198473ae3e795fac8c4811690424f167a
2020-03-20 01:40:01 +00:00
Timo Tijhof
59f67dafb8 Setup.php: Remove internal $messageMemc variable
Was originally for use by the MessageCache class, which no longer
uses it.

Bug: T243175
Change-Id: I1c62c6bba08fadf52bda4993a4e99df81b02a97f
2020-03-18 17:44:35 +00:00
Timo Tijhof
e456b68651 resourceloader: Allow 'localBasePath' for ImageModule to extension.json
This wasn't yet part of the schema, hereby added.
Being used for TemplateData in Ic8975d7ba349.

Change-Id: If661c68bea069e99cfff35711efdde7805a12851
2020-03-15 14:54:56 +00:00
jenkins-bot
f9bc3c2155 Merge "XmlDumpWriter: fix blob address output in stubs" 2020-03-13 09:51:10 +00:00
jenkins-bot
7c0c182b5b Merge "Reconcile differences between arguments in hooks.txt and at the call site" 2020-03-09 15:35:08 +00:00
Tim Starling
eb6c5f70d9 Add ParserPreSaveTransformComplete hook
This is needed to migrate an extension (AutoWIGO2) that uses ArticleSave
to a version of MW after that hook was removed. The extension was using
ArticleSave to do its own PST processing, which probably doesn't work
with PageContentSave, and wasn't really the right way to do it in the
first place. Surprisingly, there were no useful hooks in PST or its
callers.

Change-Id: If1b3d7ea130a2b77609afe206eedc8445e1ab9f9
2020-03-08 09:52:09 +11:00
Tim Starling
30d5810572 Reconcile differences between arguments in hooks.txt and at the call site
The interface generator script now flags any differences between the
argument list at the call site and the documented arguments. Resolve all
such differences.

* In AlternateEditPreview, $parserOutput is a reference, and a
  WMF-deployed extension replaces it.
* In DeleteUnknownPreferences, fix missing "$" in &$where
* In LocalisationCacheRecache, document the unused parameter, as is the
  convention elsewhere in the file.
* In NewRevisionFromEditComplete, make all callers pass a $tags
  variable, and document the fact that there are multiple callers.
* In PageContentInsertComplete, document legacy references
* In PageContentSave, document the fact that $flags and $status are
  references. I made them legacy references, since although replacement
  will have an effect, no extension relies on this and it is not
  documented on the Manual:Hooks page.
* In PageContentSaveComplete, document $wikiPage, $user, $flags and
  $status as legacy references. Replacement of $status was broken
  by If610c68f4912e89 (MW 1.32), but I confirmed that no extensions
  in CodeSearch are currently affected.
* In ParserGetVariableValueSwitch, document $frame as a legacy reference
* In WatchArticleComplete and UnwatchArticleComplete, SpecialEditWatchlist
  was passing $user by value where as the other callers were passing it
  by reference. Passed by reference. It was already marked legacy.

Bug: T240307

Change-Id: I33f69ebdb5242982fd7986d9877959d2d33149b9
2020-03-06 15:49:15 +11:00
DannyS712
2962e56f01 Remove UserIsHidden hook, deprecated and unused
Bug: T247019
Change-Id: Icb2703d20aed1d684cd897537cba71d5e1633541
2020-03-05 19:31:46 +00:00
jenkins-bot
6512ef160c Merge "Introduce an expiry to WatchedItem" 2020-03-04 18:33:07 +00:00
MusikAnimal
bb56abfba0 Introduce an expiry to WatchedItem
Includes the new $wgWatchlistExpiry feature flag.

Consumers of WatchedItem and WatchedItemStore have not been changed to
make use of expiries, this along with associated UI changes will be done
in a separate patch.

Bug: T245213
Change-Id: Ifff5e56e0222bb325cf796e0aa3d88825820d1fd
2020-03-04 11:32:19 -05:00
Tim Starling
a37adeff89 Annotate hook parameters that are references for legacy reasons.
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
2020-02-28 17:23:23 +11:00
DannyS712
28671f69b4 OutputPageBeforeHTML: Fix class of first parameter in docs
Its an OutputPage, not a ParserOutput

Change-Id: Icfff5e9f8f2254eec00368ec63b24a16e4746aed
2020-02-27 05:01:35 +00:00
Tim Starling
ff4606fd7c docs: Add missing BeforeResetNotificationTimestamp hook and MediaWikiPHPUnitTest::*
Change-Id: I1dd9cb61e7732a56fcb1fc94a347311d5572b761
2020-02-25 18:25:02 -08:00
Tim Starling
53247b5c5b Add missing colons to parameter declarations
There's no other way to detect parameters, since variable names are
often mentioned in the description prose, even at the start of a line.

Change-Id: Ie375ecffaae4efa268c5305ea9b1cc55a91cd813
2020-02-26 13:05:04 +11:00
daniel
effef5211e XmlDumpWriter: fix blob address output in stubs
* Change export schema to allow "sha1" attribute in <text> tags nested
in content tags. This was apparently overlooked when adding the location
attribute to the <text> tag for the main slot.

* Change XmlDumpWriter to only output text row IDs in <text> tags for the
main slot. Backwards compatibility is not needed for <text> tags nested
inside <content> tags.

Bug: T246074
Change-Id: I5e2bd28cc346d4a3cdc5e2dd5119eca5609385a7
2020-02-25 09:13:20 +00:00
Timo Tijhof
f575721a06 Update all use of $wgVersion to MW_VERSION
Follows-up I04628de4152dd5.

Bug: T212738
Change-Id: I718474ec0d9fd29ac2c05477f0f2493615d8aff5
2020-02-25 02:16:12 +00:00
Bartosz Dziewoński
ee1f4f8ea3 extension.schema.v2: Fix schemas for 'templates'
Synchronize the definitions for ResourceModules and QUnitTestModule.

I previously had to fix a similar problem with 'packageFiles':
I6c3d186de1877f73d4a4e3fec7d6d632a5d5fa83. And there are many other
differences. I don't have the time right now to compare them all
and decide which ones are right.

Change-Id: I9153851fe162c012967fda00d3e1f81964a8dce9
2020-02-25 01:18:26 +01:00
DannyS712
b640be36b1 Docs: Remove reference to UploadVerification hook, removed in 1.34
Was deprecated in 1.28 and removed, so it need not be mentioned as
an alternative to `UploadVerifyFile`

Bug: T220656
Change-Id: Ic1c78a0216ca6f03099c1e8433297418f3d50172
2020-02-23 01:48:56 +00:00
DannyS712
2e3bdb3498 Miscellaneous documentation updates
Update references from .txt to .md when files have moved, a few other
tweaks, no changes to code.

Change-Id: I0bfd38c47b9fb0fc11ae98a0a674af66fb4c5a84
2020-02-16 04:38:38 +00:00
DannyS712
0c303967b1 Remove double newline in hooks.txt
Change-Id: Ib2bb7ead4e4f514c9561ca050014a4582eb34d11
2020-02-13 07:54:58 +00:00
jenkins-bot
4dbc276487 Merge "Remove ArticleContentViewCustom hook, deprecated and unused" 2020-02-13 05:13:11 +00:00
Volker E
3fa38ae795 Drop the abandoned, replaced 'KSS' styleguide and references in MWUI
KSS is no longer in use anywhere. The only official style guide is
at https://design.wikimedia.org/style-guide.

Change-Id: I688a78e9a71a082c499af55bd01e8fd615130486
2020-02-11 15:38:53 -08:00
James D. Forrester
cafe286e2b Deprecate the ArticleEditUpdates hook
Change-Id: Ie85a46846315999ebaab1e1b38265937f4b2c79e
2020-02-08 20:29:35 +00:00
James D. Forrester
6a7ab1ed04 Deprecate the ArticleEditUpdatesDeleteFromRecentchanges hook
Bug: T244613
Change-Id: I2bb1645a8b5d99a5a3c4425f2bc0e8c3f524d4e8
2020-02-07 15:35:08 -08:00
DannyS712
f14fad3538 Remove ArticleContentViewCustom hook, deprecated and unused
Bug: T241351
Change-Id: Ie37ed9265511e3051ea60c6898febb567d5283df
2020-02-06 19:55:16 +00:00
Timo Tijhof
bc1f601382 docs: Improve "Entry points" documentation page
Turn this into a doc group, and let the descriptions come
directly from the files in question. This makes the list easier
to maintain, and alsom means that the overview page becomes
discoverable whenever one is looking at the entry point file
as well. Previously the doc page pointed to the entry points,
but not the other way around. This is also fixed.

Bug: T244294
Change-Id: I891c5a37e17592edc1136d7367949927121c8bc8
2020-02-04 21:44:38 +00:00
Thiemo Kreuz
ea01e7cfbb parser: Remove unused ParserAfterUnstrip hook
Introduced in 2015 via If83b062. Unfortunately the patch fails to mention
why the hook was introduced. A review comment asking for the missing
information was ignored.

The hook was introduced exclusively for the Cite extension, see I0e136f9.
The Cite change got reverted a few days later via I1a71854. As far as I
can tell the hook (oddly specific and underspecified anyway) was never
used again, neither for Cite nor for anything else.

Now unused: https://codesearch.wmflabs.org/search/?q=ParserAfterUnstrip

I suggest to just remove it with no deprecation phase.

My team is currently working on Cite, essentially turning it upside down.
I'm not aware of a need for this hook.

Change-Id: If68a88d7afff60385ff1e33fd13716b20d01a313
2020-01-25 09:20:52 +01:00
James D. Forrester
9082d22754 Drop ContentHandler::makeParserOptions(), deprecated in 1.32
Change-Id: I2d22cc8cd8fee9d8bb8b8dcdd050b64da17ac5ad
2020-01-16 16:57:21 -08:00
DannyS712
0bbe0b8fe6 Docs: Update hooks.txt to remove usage of global $wgUser
Also remove 2 refernces to $wgOut and $wgRequest

Bug: T159299
Bug: T160810
Bug: T160812
Change-Id: I267dece08d6a2224091cbcb5d29e29bd9e9d3f07
2020-01-07 19:06:04 +00:00
jdlrobson
5b044bb928 resourceloader: Introduce hooks in ResourceLoaderSiteModule
This will allow extensions/skins to alter the wiki pages that editors
can use to control styles

Bug: T237050
Change-Id: I329415b787136fcf9422a9deebfcd34f83b40f12
2020-01-06 22:52:27 +00:00
mainframe98
297a89069a Add LinkBatchFactory to inject services into LinkBatch
All services required by LinkBatch are now injected by the
LinkBatchFactory. The constructor for LinkBatch has been
soft-deprecated, but the required services are still optional.

Bug: T239855
Depends-On: If49cbb730d4ac48586b891908cf24601efbc5d6a
Change-Id: I93d931ab60305ad49a6e419f8269c77791a3938d
2020-01-06 17:02:31 +01:00
jenkins-bot
cf92c2dc44 Merge "Use namespaced IPUtils class" 2020-01-01 23:56:22 +00:00
jenkins-bot
89dbf5c1dc Merge "Convert docs/skin.txt and docs/title.txt to Markdown" 2020-01-01 23:31:42 +00:00
Kunal Mehta
99007e96c7 Use namespaced IPUtils class
Change-Id: I047e099a93203a59093946d336a143d899d0271f
2020-01-01 02:36:49 -08:00
Manuel Alcaraz Zambrano
328f78b711
docs: convert pageupdater and sitelist to markdown
Change-Id: I465831ad1fe0f05c32a44d2b47f3f19b78ba65d7
2019-12-21 19:30:58 +01:00
jenkins-bot
3a1823daf2 Merge "docs: Fix link on intro page" 2019-12-12 01:11:11 +00:00
mainframe98
ac48c84224 Allow specifying autoloaded classes for tests
This introduces two new keys to the extension schema, analogous to
the existing autoloader keys: TestAutoloadNamespaces and
TestAutoloadClasses.

The classes and namespaces defined by these keys are only loaded by
the registry when ExtensionRegistry::setLoadTestClassesAndNamespaces
is called. The phpunit wrapper does this in PHPUnitMaintClass::setup.
The unit test bootstrap file calls
ExtensionRegistry::exportTestAutoloadClassesAndNamespaces instead,
similar to how it loads the regular classes and namespaces.

Bug: T196090
Change-Id: I88cf69663362fd599c20649b1df641907a02678d
2019-12-10 21:39:30 +00:00