Commit graph

224 commits

Author SHA1 Message Date
daniel
5ac84ffd12 REST /me/contributions: return revisions
This is part of a chain of patches to complete the REST User Contributions
endpoint. This change returns a list of the 2 (hard-coded for now) most
recent revisions for a given user.

Package.json was also updated for new api-testing module (v 1.1.0)

Bug: T252202
Change-Id: I42a5dfc0e1ff7600848e89ac2c4b002e8a3612df
2020-06-09 08:19:45 -07:00
Nikki Nikkhoui
300fcfd00b REST me/contributions: Returns 401 Unauthorized
This is the first in a chain of patches that iteratively create
the me/contributions endpoint that returns a list
of contributions by the currently logged in user.

This patch contains stubs for major classes needed
as well as implementation and test just for returning
a 401 Unauthorized for anonymous users.

Bug:T252202
Change-Id: Ib75711bb015f476e9d486cb3008eb7b06b148d00
2020-06-09 15:00:25 +00:00
daniel
2051b84e5f PageHistoryHandler: fix self-reference route
THis introduces Handler::getRouteUrl() and uses it in
PageHistoryHandler() to generate self-reference links to adjacent
segments of the response.

Bug: T252566
Change-Id: Ie7b2c6cc63c8a499d4714336b917a9e3328294ca
2020-06-08 18:56:26 +02:00
Translation updater bot
ee5892141b Localisation updates from https://translatewiki.net.
Change-Id: I446f6ae6b92ccc25033ebf7d4686da45baa05372
2020-06-08 08:47:58 +02:00
Tim Starling
68c433bd23 Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.

General principles:
* Use DI if it is already used. We're not changing the way state is
  managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
  is a service, it's a more generic interface, it is the only
  thing that provides isRegistered() which is needed in some cases,
  and a HookRunner can be efficiently constructed from it
  (confirmed by benchmark). Because HookContainer is needed
  for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
  SpecialPage and ApiBase have getHookContainer() and getHookRunner()
  methods in the base class, and classes that extend that base class
  are not expected to know or care where the base class gets its
  HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
  getHookRunner() methods, getting them from the global service
  container. The point of this is to ease migration to DI by ensuring
  that call sites ask their local friendly base class rather than
  getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
  methods did not seem warranted, there is a private HookRunner property
  which is accessed directly. Very rarely (two cases), there is a
  protected property, for consistency with code that conventionally
  assumes protected=private, but in cases where the class might actually
  be overridden, a protected accessor is preferred over a protected
  property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
  global code. In a few cases it was used for objects with broken
  construction schemes, out of horror or laziness.

Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore

Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router

setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine

Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-05-30 14:23:28 +00:00
apaskulin
590d8a9b06 docs: Fix typo in doc comment
Fixes a typo in the doc comment for two hook interfaces.

Change-Id: I8b2075ea0029620baef4514439c22b727a1f9c42
2020-05-29 11:10:32 -07:00
jenkins-bot
f11aee48da Merge "CreationHandler: fix redirect URL" 2020-05-26 19:07:43 +00:00
Reedy
229b2c15e8 Fix a plethora of class and function call case mismatches
Bug: T231412
Change-Id: I597a25de3294a6673424f30475760280ef209a8a
2020-05-26 14:14:46 +01:00
daniel
504e9c446f CreationHandler: fix redirect URL
Add missing version prefix to Location header emitted after successful
creation.

Bug: T253143
Change-Id: I6262f61668cefacce12ed6f2a976340e10cf105b
2020-05-25 11:13:18 +02:00
Translation updater bot
7fc72f37a8 Localisation updates from https://translatewiki.net.
Change-Id: Ice9d0ab4e13859fe7bcc07214ca1149271adaa27
2020-05-22 08:33:50 +02:00
jenkins-bot
fa2bb52e9a Merge "Fix typo 'desciption'" 2020-05-21 23:47:36 +00:00
MarcoAurelio
dbfebbbcec Fix typo 'desciption'
Should be 'description'.

Bug: T201491
Change-Id: Ic6d7efb8da2fb1c9645ca4c4e666d10953b8a4ab
2020-05-21 18:42:35 +00:00
Nikki Nikkhoui
eeac328472 Move Search endpoints into core routes
Move both search endpoints from coreDevelopmentRoutes to coreRoutes, making them
accessible in a production environment.

Change-Id: I14c1a9eb4c76a22f72caa7ae201699d4ef9eb282
2020-05-20 11:52:47 -07:00
Translation updater bot
21cdf3740c Localisation updates from https://translatewiki.net.
Change-Id: Id9fc26a72daf0f95828247b6e84ac8913f36a7ba
2020-05-18 08:28:03 +02:00
Reedy
b80a9f4f6a Fix even more PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I5e04824d6fa6a4c36ce489850bb0ed7b4ac588f9
2020-05-16 00:51:14 +01:00
jenkins-bot
666af800d7 Merge "Rest: Add Handler::postInitSetup" 2020-05-13 07:15:54 +00:00
Translation updater bot
7d574626a8 Localisation updates from https://translatewiki.net.
Change-Id: I23d04fa98de700eb3fa93094e39c0e78373b7ea6
2020-05-13 08:41:19 +02:00
Tim Starling
827ab362b2 Rest: Add Handler::postInitSetup
Overriding init() in a Handler subclass defeats the purpose, which is to
hide the dependency list from handlers so that it can change without
breaking the handlers. If init() was overridable, we could have just
merged it with the constructor.

Make init() final to enforce this. Add postInitSetup() to provide a hook
point which serves SearchHandler's requirements without exposing internal
details.

Change-Id: I91d95ad48b3741ef811ba5517f3a9ef2b435499e
2020-05-13 09:18:16 +10:00
Translation updater bot
6166714589 Localisation updates from https://translatewiki.net.
Change-Id: I5717e550d6f6c76a1610521c94a738e46c2a43f6
2020-05-12 08:19:45 +02:00
Translation updater bot
89157202af Localisation updates from https://translatewiki.net.
Change-Id: Iad2d93fb615495863e5f55ab506545877425b01e
2020-05-11 08:35:29 +02:00
Reedy
12a3883a7b Fix SingleSpaceBeforeSingleLineComment
Change-Id: I285af438ce484af40741489797f20455726ec110
2020-05-11 00:57:11 +00:00
Umherirrender
709fbb867d Add missing public visibility on rest related interface methods
Change-Id: Id56beab0f187b8d9c1e4fca536fd0d0eb711e989
2020-05-09 11:17:27 +00:00
Translation updater bot
3963d7256a Localisation updates from https://translatewiki.net.
Change-Id: Ic2845c31b4dc6962cacefe51b76551247625e031
2020-05-07 08:32:56 +02: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
Ed Sanders
387f3c2a20 Fix typo: 'the the' -> 'the'
Change-Id: Ia57fb787b43c8e49da4f33a65c265cbc37ee1f77
2020-05-03 20:45:36 +01:00
Translation updater bot
26b8956cb4 Localisation updates from https://translatewiki.net.
Change-Id: I88de7a989788a9e0cdecdaceb07fe7fd854e1030
2020-05-01 09:59:13 +02:00
Translation updater bot
89d80bf518 Localisation updates from https://translatewiki.net.
Change-Id: Iaed7e5621edf52b79370522f543de7e3d228717a
2020-04-30 08:35:30 +02:00
Translation updater bot
ee165d568d Localisation updates from https://translatewiki.net.
Change-Id: Id891bc962e0f2898728b34d43f9f70aacca0f5e8
2020-04-29 08:34:04 +02:00
Translation updater bot
665eb06961 Localisation updates from https://translatewiki.net.
Change-Id: Ib4de848ba9c31641124f88a250a0cfbb09739f3a
2020-04-28 08:30:48 +02:00
Peter Ovchyn
76f881405d rest: Replace backtick with double-quote in English messages for REST API
Bug: T249827
Change-Id: I42a4db4e7a2d26e1cdabc80de04bbc8460daf512
2020-04-27 11:29:17 +03:00
Translation updater bot
2a00428040 Localisation updates from https://translatewiki.net.
Change-Id: Ibdafc82a472000f13981b9c9bdfee46ede3c4efb
2020-04-20 08:39:32 +02:00
Translation updater bot
8855e7d45b Localisation updates from https://translatewiki.net.
Change-Id: Iede122395424adc4024eb36ae93674faffe8da1f
2020-04-17 09:05:29 +02:00
jenkins-bot
3e29dd85ed Merge "doxygen: Changed Doxygen tags causing warnings during documentation generation" 2020-04-16 18:45:56 +00:00
Translation updater bot
e9163c5a1d Localisation updates from https://translatewiki.net.
Change-Id: Ieeb321848530b5294c00e0196f3e806d10a61c3e
2020-04-16 08:48:52 +02:00
Holger Knust
471d2371ab doxygen: Changed Doxygen tags causing warnings during documentation generation
Updated Doxygen markup in several .php files triggering warnings when mwdocgen.php is executed. Removed
obsolete settings MSCGEN_PATH and TCL_SUBST from Doxyfile. The former would generate a warning in 1.8.16
while TCL support was removed in 1.8.18. Since TCL_SUBST was blank anyway, it was removed prior to getting
to .18 in production. Increased DOT_GRAPH_MAX_NODES from 50 to 200 since Doxygen complained about it being
too low for API and Maintenance.

Bug: T248706
Change-Id: I9c67f0807d1b43089d351263d4f591dee5501f36
2020-04-14 03:25:19 +00:00
Translation updater bot
7c077ba897 Localisation updates from https://translatewiki.net.
Change-Id: I01239f0b37d691d3abcedbef95258c3747b5d65b
2020-04-13 08:54:44 +02:00
Translation updater bot
d749eda954 Localisation updates from https://translatewiki.net.
Change-Id: Ie128ee73523b460244b61ccdfda5d11ea83e3af3
2020-04-10 09:21:35 +02:00
MusikAnimal
2d21ee58ec Add expiry type to ParamValidator
This commit also changes ApiWatch to make use of the new parameter type.
Other APIs will be updated to use it in a separate patch (T248196).

In doing this, we are for the first using logic within a TypeDef outside
the API. This seems acceptable given TypeDefs chiefly appear to serve as
a validation method, with otherwise no particular logic tied to the
concept of APIs.

wfIsInfinity() now uses ExpiryDef::INFINITY_VALS

Bug: T248508
Change-Id: If8f0df059eafb73ec9f39cc076b3a9ce2412d60a
2020-04-08 16:21:04 -04:00
Translation updater bot
9b125a09ae Localisation updates from https://translatewiki.net.
Change-Id: I5056d6d289329ff50f3ec360955476549a5c06b5
2020-04-08 08:22:12 +02:00
Translation updater bot
3a22768cb5 Localisation updates from https://translatewiki.net.
Change-Id: Ie96d145b645c46155e96b999350e653c4b47e9a9
2020-04-07 08:32:12 +02:00
jenkins-bot
f98a9e576a Merge "SearchHandler: emit Cache-Control header." 2020-04-06 15:53:50 +00:00
daniel
7d8fe94ea2 SearchHandler: emit Cache-Control header.
Completion search used for type-ahead should make use of http caches,
like ApiOpenSearch does.

Bug: T245675
Change-Id: Ia8366684203381b6c4dc55669a6877e53e9ffe40
2020-04-06 13:37:49 +02:00
Translation updater bot
9c9f821db4 Localisation updates from https://translatewiki.net.
Change-Id: I472675b465d7c09baa095eb0587a334afa562f1c
2020-04-06 08:16:48 +02:00
jenkins-bot
f7cc59670c Merge "WebRequest & RequestFromGlobals: get HTTP headers in one way" 2020-04-03 15:08:34 +00:00
Pablo Grass
ff40270448
WebRequest & RequestFromGlobals: get HTTP headers in one way
apache_request_headers() is a vendor-specific function - it got used
when present and alternative code paths were exercised otherwise.
These preserved certain "special" headers, e.g. Content-Type, only
inconsistently.

The function getallheaders() is an alias[1] for apache_request_headers()
on systems where the latter is present. Alternatively, there is a
polyfill (ralouphie/getallheaders) which is already installed in
mediawiki-vendor[2] (by virtue of guzzle).

Using getallheaders() exclusively, will make sure these "special"
headers are consistently available alongside their "regular"[3] peers
and helps MediaWiki code focus on its domain.

The dependency to ralouphie/getallheaders is made explicit in the same
version in which it is currently locked in mediawiki-vendor[4].

This surfaced because the deprecation warning for API POST requests
without a Content-Type header, introduced in bba1a0f, appeared in my
development system (somewhat dated addshore/mediawiki-docker-dev/) even
though the client did a fine job.

Interesting implementation detail: While WebRequest keeps track of
headers using keys in all upper case, REST RequestFromGlobals does so in
all lower case - but both use retrieval logic complementary to their
respective approach however. In case of REST RequestFromGlobals this is
encapsulated inside of HeaderContainer (setting and retrieving), while
WebRequest does all of this by itself. Cf. [5] and [6]

[1]: https://www.php.net/manual/en/function.getallheaders.php
[2]: https://github.com/wikimedia/mediawiki-vendor/tree/8f2967d/ralouphie/getallheaders
[3]: https://www.php.net/manual/en/reserved.variables.server.php#110763
[4]: https://github.com/wikimedia/mediawiki-vendor/blob/8f2967d/composer.lock#L3250
[5]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
[6]: https://www.php.net/manual/en/function.apache-request-headers.php#124236

Bug: T245535
Change-Id: Iba52f152e15928473b729a2588c2462e76e85634
2020-04-03 09:32:41 +02:00
Translation updater bot
7ab9daa376 Localisation updates from https://translatewiki.net.
Change-Id: I81de6d8a0f60794c93639ebba5ba3a28f3ed0e2f
2020-04-03 08:27:18 +02:00
Translation updater bot
b9c99d370f Localisation updates from https://translatewiki.net.
Change-Id: I0fa2aa42c4617ebd9a0624b226b72afa8b62b9e6
2020-04-01 08:23:49 +02:00
Translation updater bot
7899d716d6 Localisation updates from https://translatewiki.net.
Change-Id: Ib4dcca3f89b97f9baca3df5a7a34c1bad0979bc6
2020-03-31 08:27:34 +02:00
Translation updater bot
d7f4f7c2a5 Localisation updates from https://translatewiki.net.
Change-Id: Iffce1621d37b02710d51ac98bfcbc62423321547
2020-03-30 09:11:38 +02:00
jenkins-bot
83fc4e8c11 Merge "SearchHandler: add support for completion search" 2020-03-27 15:55:48 +00:00