Commit graph

1613 commits

Author SHA1 Message Date
RazeSoldier
b95a76ae9e Drop APIEditBeforeSave hook
Removed the source code and the test code.

Bug: T220656
Change-Id: I3674da6d9c33c08ec2f1774cb793b3a952480571
2019-07-02 02:58:47 +08:00
jenkins-bot
8f8374204e Merge "Add support for xml dump schema 0.11" 2019-06-28 04:23:58 +00:00
daniel
fdc3e9f952 Add support for xml dump schema 0.11
Bug: T174031
Change-Id: I2717019ea7efe36694bd2b2fba4dc2952a987cfc
2019-06-27 21:56:01 +00:00
David Causse
92c20832f1 Deprecate SearchResult::termMatches()
And start indicating that hooks relying on this data might become
unreliable as this data is only populated by SearchDatabase search
engines.

This information was only populated by SearchDatabase implementations
and due to bad initial design of SearchResult[Set] (now fixed) it forced
users of these classes to carry this information for the sole purpose of
highlighting.
Because SearchEngine can now own their SearchResult[Set] implementations
nothing that is engine specific should be exposed outside of these
specific implementations.
If there are some logic that still requires access to such list of terms
they should be made engine specific by guarding their code against
instanceof SqlSearchResult.

Change-Id: I38b82c5e4c35309ee447edc3ded60ca6a18b247a
Depends-On: I53fe37c65c7940f696c1e184125e01e592a976e4
2019-06-27 08:44:06 -07:00
James D. Forrester
06a34d5895 Drop the UserLoadFromSession hook, deprecated in 1.27
Change-Id: Ic86d9ee1fe6763270e79e31296ecd027e5d41be2
2019-06-24 14:12:33 -07:00
James D. Forrester
614f15682c Drop the UserRights hook, deprecated in 1.26
Change-Id: Ib4dc6f495c0d1d2aa1f41c1f61e09437f33c9077
2019-06-24 11:11:17 -07:00
Fomafix
110a5877e9 Use [...] instead of array(...) in PHP comments and documentation
Change-Id: I0c83783051bf35fe785bc01644eeb2946902b6b2
2019-06-17 21:15:09 +02:00
jenkins-bot
8ffabe23a1 Merge "Fix param type of search terms in search related classes" 2019-06-17 07:54:27 +00:00
Umherirrender
9421f6f52f Fix param type of search terms in search related classes
Change-Id: I036434268f1e7992f7f9f23d2c1c0fcd399823c8
2019-06-14 19:50:12 +02:00
jenkins-bot
7c966af21a Merge "REST API initial commit" 2019-06-13 22:18:21 +00:00
Tim Starling
3f0056a252 REST API initial commit
Add some of the basic REST API class hierarchies:

* EntryPoint
* Router
* Request
* Response
* Handler

The actual entry point file rest.php has been moved to a separate
commit, so this is just an unused library and service.

Bug: T221177
Change-Id: Ifca6bcb8a304e8e8b7f52b79c607bdcebf805cd1
2019-06-12 10:22:28 +10:00
jenkins-bot
6e30404bae Merge "registration: Deprecate ParserTestFiles in extension.json" 2019-06-09 20:13:23 +00:00
Umherirrender
8a14f73a64 Document $rows on hook ChangesListInitRows as IResultWrapper
Change-Id: I243b460c4788a2bee095cb76b76106577f06b96f
2019-06-03 21:35:51 +02:00
Kunal Mehta
286a2a1852 registration: Deprecate ParserTestFiles in extension.json
Warnings will be emitted whenever validation is checked or unit tests are
run.

Bug: T192154
Change-Id: Ib968f696890667841d850ef5562e05989cb4f431
2019-06-02 21:53:31 -04:00
jenkins-bot
a1c74d9ca8 Merge "registration: Add development requirements to extension.json" 2019-05-22 21:41:48 +00:00
jenkins-bot
14d3067b09 Merge "registration: Fix validation of ext-foo values" 2019-05-22 10:12:52 +00:00
Kunal Mehta
1aa819513b registration: Add development requirements to extension.json
Extensions can specify development dependencies in extension.json under
the "dev-requires" key. It's identical to the "requires" field.

Any requirement that is needed to pass tests, including but not limited
to, PHPUnit, QUnit, structure, phan, should be documented in this new
field. The main intention is that CI will ensure that all of these
dependencies are satisfied before running tests.

At standard runtime, the development requirements will be ignored by
MediaWiki, since it only checks for real requirements. Scripts can
manually check development requirements by calling
ExtensionRegistry::setCheckDevRequires( true ) before trying to load
things.

If both "requires" and "dev-requires" are present, MediaWiki will merge
the two together, so the environment will need to satisfy both before
proceeding.

Bug: T193824
Change-Id: I9b2936666ee3c96f5c976c7a17f11c437c2c7f48
2019-05-22 01:59:33 -07:00
Kunal Mehta
cfd5d33da2 registration: Fix validation of ext-foo values
Our json-schema library doesn't yet support "const" (at least not in a
released version), so use "enum" with one element, since it's functionally
equivalent per <https://json-schema.org/understanding-json-schema/reference/generic.html#constant-values>.

Change-Id: Ib9ebb5c6b9d07903fa47603fbe54a148e9c00352
2019-05-22 01:57:32 -07:00
Thiemo Kreuz
177211eb28 docs: Fix UploadVerifyUpload/UploadStashFile hook docs
1. FSFile::getPropsFromPath() is not used by any code any more.
https://codesearch.wmflabs.org/search/?q=FSFile%3A%3AgetPropsFromPath&i=1
The only remaining usage is in one test. We might as well remove the
function.

2. The $props array is passed to the hook for convenience, in case all
the file properties are already available. Fetching them from a file on
disc can be an expensive operation, and should be avoided if the
information is already available. But the caller does not guarantee this
is set. Other callees already know this can be a falsy value, notably
LocalFile::upload().

Change-Id: I43724d18467b6fb68a963b2206332cf553c81b2c
2019-05-18 08:38:20 +02:00
Niklas Laxström
855b1794b6 Unstub $wgLang for PageContentLanguage hook
This is to avoid annoying fatal errors when someone annotated their
hook handler to only expect Language objects, but that expectation
is violated due to this code possibly passing StubUserLang to hooks,
some of which may also assign it to $pageLang.

Even with this in place, it is probably a good idea for hook handlers
to refrain from type hinting parameters that are passed by reference
because their types cannot be guaranteed.

Bug: T214358
Change-Id: I88405a8de4b13675eb5a9d11e9ddc87e20a85fb4
2019-05-16 18:49:53 +02:00
jenkins-bot
25ee9366b0 Merge "Corrected grammatical error." 2019-05-08 20:05:33 +00:00
Michal
57b49eb161 Corrected grammatical error.
Change-Id: I4af843238ffd58925f57c0f7b98253a90cb284ec
2019-05-08 15:32:21 -04:00
Fomafix
f0483b35c7 Remove parameter 'options' from hook 'SkinEditSectionLinks'
The generated links are now always known links.

All users of the hook 'SkinEditSectionLinks' in extensions set
'options' => [ 'noclasses', 'known' ]
5f48eb9acd/TinyMCE.hooks.php (291)
857c1bd3d1/includes/VisualEditorHooks.php (617)

This change makes it easier to migrate to LinkRenderer in
Ifc170abc958add28a2fe08aa0c44af83c6f7cad8 without legacy options.

Change-Id: Ia5d151b81dabce9560045b45886f2c77abf975da
2019-05-03 15:01:57 +02:00
zoranzoki21
7edefa30d9 docs/kss/package.json: Update Gerrit /r/p/ link to /r/
Bug: T218844
Change-Id: Ie503c5f7dc3bd89d983c1b368e25a4d185ae617e
2019-04-29 23:31:02 +00:00
MGChecker
5e2c7466ad registration: Allow to require environment abilities
This patch adds the possibility for extensions and skins to require
certain environment abiltites that are not necessarily PHP extensions.

For now, the only ability introduced is the ability to shell out, but
the processing and testing is written in a more general way to allow
users to add more abilties later on by just changing getAbilities().

In theory, this allows using VersionChecker to check for random
abilities if they are specified in the constructor, as it is comletely
environment agnostic and not really bound to just be used for checking
extension compatibility.

Furthermore, it is possible to specify custom error messages for each of
these abilities in the constructor. Other parts of MediaWiki may use
these features to check for requirements while working with totally
different abilities.

Bug: T212472
Change-Id: Iff8512530b08ef509e7ac0b6ed8fe9578ef3e2a1
2019-04-13 08:14:44 -07:00
Aaron Schulz
2775ad190c rdbms: drop inappropriate and poorly documented "DatabaseOraclePostInit" hook
Change-Id: I3152e80d99b040b7918927e6c2a215cab59a9b10
2019-04-12 14:41:44 +00:00
Aryeh Gregor
76661cf129 NamespaceInfo service to replace MWNamespace
MWNamespace::clearCaches() has been removed entirely, along with the
$rebuild parameter to MWNamespace::getCanonicalNamespaces(). The rest of
MWNamespace is deprecated.

Diff best viewed with -C1 so git notices that NamespaceInfo is a copy of
MWNamespace.

Depends-On: Icb7a4a2a5d19fb1f2453b4b57a5271196b0e316d
Depends-On: Ib3c914fc99394e4876ac9fe27317a1eafa2ff69e
Change-Id: I1a03d4e146f5414ae73c7d1a5807c873323e8abc
2019-04-10 02:07:36 +00:00
jenkins-bot
a38af7ba26 Merge "Improve docs for Title::getInternalURL/getCanonicalURL" 2019-04-07 17:25:33 +00:00
Lucas Werkmeister
187b1d48b3 Add &$tags argument to MarkPatrolled hook
This will allow the OAuth extension to subscribe to this hook and add an
“OAuth CID: $consumerId” tag to patrols made via OAuth.

Bug: T219655
Change-Id: Ie5e6f820bbf399ec639e715afd908f78bf5c8e9a
2019-04-01 10:10:34 +02:00
Bill Pirkle
4d5edb65f3 Allow extensions to add params to the update.php maintenance script
T110209 caused maintenance scripts to fail on unknown parameters,
which is normally desirable.  However, some extensions (notably
SemanticMediaWiki) need to support additional params and had no
way to add them to the list of expected parameters.  It will
now be possible them to update.php via a new hook:
MaintenanceUpdateAddParams.

Bug: T213893
Change-Id: Ia40949ccb2f32090f21e0f3f7e5b9c4aef322330
2019-03-26 21:12:49 -05:00
jenkins-bot
28b8d632ad Merge "docs: Update outdated PageContentSave hook documentation" 2019-03-25 06:40:12 +00:00
jenkins-bot
081a44ff0c Merge "Validate the output of the dump scripts." 2019-03-20 23:13:50 +00:00
daniel
94d559b149 Validate the output of the dump scripts.
This introduces XML schema validation into the unit tests for
the backup dump scripts. This is intended to ensure that the
output keeps conforming to the schema when updating XmlDumpWriter
and friends to support newer schema versions.

Bug: T174031
Change-Id: Iafa8cb8ba5b3684a08172e92974edaf0482f19b7
2019-03-20 22:25:20 +01:00
Piotr Miazga
384ab964cd Define ManualLogEntryBeforePublish hook
This hook is required by extensions like MobileFrontend to tag
log entries when actions are performed on the mobile web.

There is a possibility to tag log entries by using
'RecentChange_save' hook, but that works only when the log entry
is published to 'rc' or 'rcandudp'. This means, that tagged log
will appear also on the Special:RecentChanges page which is something
what extensions like 'Thanks' wants to avoid.

In the future we should avoid using 'RecentChange_save' as an
indirect way to tag log entries, and use the
'ManualLogEntryBeforePublish' hook instead.

To cover ourselves in the future, instead of passing &$tags only,
we pass the $this (the log entry object) so extensions can perform
additional checks before using setTags().

Bug: T215675
Change-Id: I747eded4bc5406cd5d4676fc93b0bb55c99f9a4d
2019-03-19 00:49:53 +01:00
Timo Tijhof
4677392718 Remove wgSitesCacheFile and rebuildSitesCache.php (unused)
This seems to have been intended as optimization for SiteStore,
but was never used as far as I can tell. Instead, SiteStore is
already cached via LocalServerCache (APC).

Keep the FileBasedSiteLookup class for one release cycle in case
third parties not indexed by MediaWiki Codesearch are using it.

== History

* 2013: Report of high memcached usage by Wikibase via SiteStore.
* 2014: Lazy-load the data in Wikibase (d3f2e99cb6).
* 2014: Implement the file-based cache (via T47532 and 90f6efc360).
* 2015: Use local-server cache (APC), per T58602.

The file-based code was never used. The related task marked
invalid (T47532).

Change-Id: I8e2d9edcf3880149f824cc3de37793ca57435b49
2019-03-15 20:03:44 +00:00
Umherirrender
febf5f7a15 Improve docs for Title::getInternalURL/getCanonicalURL
Both calling fixUrlQueryArgs, which handle the array case
Also improve hooks docs for the similar functions getLinkUrl/getLocalUrl

Change-Id: I77df39711c7d6b2ee0a3709a6bdaf9cde6a616c6
2019-03-15 18:56:04 +01:00
jenkins-bot
787da207a2 Merge "Improve documentation of the PageContentLanguage hook" 2019-03-12 07:33:57 +00:00
Niklas Laxström
a08fc9eed6 Improve documentation of the PageContentLanguage hook
Clarify that the type of second parameter that is being passed
to the hooks can be anything because one hook can change it and
then it is passed to another hook without the hook caller having
possibility to check or modify the value.

Clarify that hooks should only return Language objects.

Rename $wgLang to $userLang in the hook parameter documentation to
avoid false posivite matches for the global.

Fix some typos, use Title::inNamespace and add a test assertion.

Also, the $content parameter is unused by all implementations of
this method, and on quick look never passed by any caller. I kept
it for now, however.

Bug: T214358
Change-Id: Iae49d2998c2b762565d232c0337d84d43a4a900c
2019-03-12 08:05:59 +01:00
jenkins-bot
91a693919e Merge "Specify licence of mediawiki ontology.owl" 2019-03-05 19:45:10 +00:00
James D. Forrester
3f717984c1 Drop AuthPlugin and related code, deprecated in 1.27
Bug: T215843
Depends-On: Ie49709faa6f67b0a31bd546823d29dbfea0a70eb
Depends-On: If8109dbfdeeb88a6265f4cd79d1ae81bff48d934
Depends-On: I36b195fa2d6c23a76631ebaf869c787e44427d60
Depends-On: Iaa171b085fde331eab7d85c7de74523e27fc625a
Change-Id: I330b30d6582034a233fed204c0680b1ce84eec6e
2019-03-05 08:23:14 +00:00
Greta Doçi
9ba30e6047 Specify licence of mediawiki ontology.owl
Bug: T216842
Change-Id: Ide976016bc5d421458cfe4ad661d88bb32da61a6
2019-03-04 16:12:13 +01:00
Fomafix
4b46994799 Fix usage of MediaWikiServices in comments and documentation
MediaWikiServices::getFoo()

is wrong. Right is:

MediaWikiServices::getInstance()->getFoo()

Change-Id: Ib6d844ddfe5bd6ccd72b887a63d9ad476c8d196f
2019-03-03 14:09:33 +00:00
Roan Kattouw
10f7497eab Add UserSendConfirmationMail hook
Allow extensions to modify the confirmation email.

Bug: T215665
Change-Id: I4bcf76699a5114292fc19085fe441de8b898a8d3
2019-02-27 16:44:43 -08:00
Thiemo Kreuz
0df33031fa docs: Update outdated PageContentSave hook documentation
I updated https://www.mediawiki.org/wiki/Manual:Hooks/PageContentSave
already.

Inspired by Id8f2ac2.

Bug:  T216893
Change-Id: I41a310c04be37693c1ba3f8ce15d1405674c1eae
2019-02-26 14:15:35 +01:00
Kunal Mehta
0a8a4fe75e registration: Fix 'ResourceLoaderWikiModule' schema validation
There is a full schema for ResourceModules when the
class: ResourceLoaderWikiModule is used. Except it doesn't actually work,
since it it fails validating against that schema, it will continue to check
the other anyOf schemas, find the arbitrary class one, and pass that one.

Blacklisting ResourceLoaderWikiModule from the arbitrary class schema means
that it has to pass the specified schema for it, or fail validation.

I verified that all extensions and skins in Gerrit pass validation with this
patch.

Change-Id: Icb862088c0ca1f89ed5a57a4286dd9049d213021
2019-02-22 17:17:05 -08:00
Kunal Mehta
291fcff08e registration: Fix 'arbitrary ResourceLoaderModule definition' schema regex
We want this regex to match on everything that is not the literal string
'ResourceFileModule' or 'ResourceImageModule' (actually
'ResourceLoaderWikiModule' should be in this too, but I'll fix that in a
follow-up). But the current regex would not match if one of those was in a
substring.

The new regex should match everything that is *not* those two strings.

Bug: T216861
Change-Id: I7d888adfdc67b2075028e49432710308aa0125af
2019-02-22 17:03:01 -08:00
jenkins-bot
37ef56fadd Merge "registration: Allow @-prefixed keys in manifest_version 2" 2019-02-14 06:38:04 +00:00
Stanislav Malyshev
341bd5d6e9 registration: Allow @-prefixed keys in manifest_version 2
As specified in
<https://www.mediawiki.org/wiki/Manual:Extension_registration#Retaining_documentation>.

Bug: T215650
Change-Id: I2ff523828389fbec39cdf7c55046e7da901a2ecb
2019-02-12 18:50:14 -08:00
Gilles Dubuc
bd2a9bfd97 registration: Define packageFiles for v1 extension schema
Follows 56fa42d433.

Bug: T215756
Change-Id: Icbf433b6b147f53cf99533a7272fc83392a8999d
2019-02-11 20:45:20 +00:00
Gilles Dubuc
2996a9a0e4 Add ability to define packageFiles in extension.json
Bug: T215756
Change-Id: I97c3ccc13c54b424952ce15509b98a217b2670b1
2019-02-11 10:53:09 +01:00