Commit graph

1938 commits

Author SHA1 Message Date
jenkins-bot
7df99f2dae Merge "REST: Make module definition files more like OpenAPI specs" 2024-06-24 20:36:14 +00:00
daniel
79c61e80dc REST: Make module definition files more like OpenAPI specs
This splits RouteFileModule into two classes, ExtraRoutesModule and
SpecBasedModule.

ExtraRoutesModule has no module prefix and supports
only "flat" route definition files and additional routes from
extension.json.

SpecBasedModule represents a single module defined in a definition
file similar to an OpenAPI spec. The idea is that a full OpenAPI spec
can be generated by filling in any missing information based on
information provided by the Handler implementation. In particular, the
definition of parameters and request body schemas will be generated.

A JSON schema for the new file format is added under docs/rest/.

Support for the intermediate format introduced in Iebcde4645d4 is
removed. It was not included in a release and was not being used outside
core tests.

Bug: T366837
Change-Id: I4ce306b0997f80b78a3d901e38bbfa8445bed604
2024-06-24 16:42:59 +02:00
jenkins-bot
4d5d9a6dae Merge "Add ApiLogFeatureUsage hook" 2024-06-14 19:13:31 +00:00
jenkins-bot
286f49b678 Merge "Add Special:RestSandbox for exploring REST API" 2024-06-14 01:19:30 +00:00
daniel
c01b7c7b4b Add Special:RestSandbox for exploring REST API
Special:RestSandbox presents a Swagger-UI interface for exploring REST APIs. The available APIs can be configured using RestSandboxSpecs.

For now, the default is to support no APIs, so the feature is disabled in production. In the future, it would make sense to expose the wiki's own REST API per default. The corresponding entry in $wgRestSandboxSpecs in LocalSettings.php would look like this:

	'mw' => [
		'url' => $wgScriptPath . '/rest.php/',
		'name' => 'MediaWiki REST API',
	]

Note that the spec URL may still change.

To also explore the endpoints exposed through RESTbase, we might add:

	'wmf-restbase' => [
		'url' => $wgServer . '/api/rest_v1/',
		'name' => 'Wikimedia RESTbase API',
	]

Similarly, we could expose a spec for endpoints on api.wikimedia.org, which could then be explored using the new special page.

NOTE: This adds a dependency on the swagger-ui npm library. See T325558 for the security review.

Bug: T362006
Change-Id: I1dd5ed82680a28f9c15136b446a2de0398525061
2024-06-13 21:40:36 +02:00
jenkins-bot
914fa87e51 Merge "user: Split a base class out of ApiOptions" 2024-06-13 13:06:34 +00:00
jenkins-bot
ce3767dd85 Merge "user: Introduce UserOptionsStore" 2024-06-13 13:06:27 +00:00
Aaron Schulz
0758620460 Add ApiLogFeatureUsage hook
Bug: T313731
Change-Id: I8bbf806501d542a0f91a67e197913a894bdee127
2024-06-12 13:49:50 -07:00
James D. Forrester
19f4e6945a Rename JsonUnserial… to JsonDeserial…
This is to make it clearer that they're related to converting serialized
content back into JSON, rather than stating that things are not
representable in JSON.

Change-Id: Ic440ac2d05b5ac238a1c0e4821d3f2d858bc3d76
2024-06-12 14:50:58 -04:00
Tim Starling
ca615f369a user: Split a base class out of ApiOptions
This gives us the flexibility to add features to core without
affecting GlobalPreferences.

Split getUserForUpdates() into asserting and non-asserting variants
since most things are using it without checking for a null return.

Bug: T323076
Change-Id: I53e5c409a650397fde03a8578b0182f0b97927a9
2024-06-12 02:08:49 +00:00
Tim Starling
cdc5178150 user: Introduce UserOptionsStore
Refactoring:

* Break out the database access part of UserOptionsManager to a separate
  class hierarchy implementing interface UserOptionsStore. It's
  basically a key/key/string-value store, very simple. The complex
  parts of user options storage remain in UserOptionsManager.
* Bundle the UserOptionsManager caches into a per-user cache object. I
  was adding a couple more and it was getting tedious.

Start integrating GlobalPreferences with UserOptionsManager:

* Have an array of stores. There's always a local store, and extensions
  can add stores via an attribute.
* Add $global parameter to UserOptionsManager::setOption(), allowing
  this method to update or override global options.
* Rename loadOptionsFromDb to loadOptionsFromStore.
* Move the local override feature from GlobalPreferences to core.

Bug: T323076
Change-Id: Ib3623b723557c819bc0ffdf21a4ffcb070eb298b
2024-06-12 01:27:57 +00:00
Aaron Schulz
b823c3dad1 rdbms: remove deprecated IDatabase::nextSequenceValue() method
Change-Id: Ic01a6d5b7951f53898f4cb4c19de1210beb5af85
2024-06-03 12:50:54 -07:00
jenkins-bot
6dfa3b8a3b Merge "rdbms: Create RawSQLValue for SET clauses in update/upsert" 2024-05-29 11:31:31 +00:00
jenkins-bot
5fe2040130 Merge "rdbms: Introduce IDatabaseForOwner" 2024-05-29 00:12:38 +00:00
Bartosz Dziewoński
b18e4b3517 Add library to display the login form in a JavaScript modal dialog
Experimental library that can display the login form in a small
browser popup window, a new browser tab or window, or an iframe in
a modal message dialog. We're still testing which of these methods
work from the technical side, and which are understandable for users.
Some methods or the whole library may be removed in the future.

Usage:
    const authPopup = require( 'mediawiki.authenticationPopup' );
    authPopup.startPopupWindow()
    // or: authPopup.startNewTabOrWindow()
    // or: authPopup.startIframe()
        .then( function ( userinfo ) {
            if ( userinfo ) {
                // Logged in
            } else {
                // Cancelled by the user
            }
        }, function ( error ) {
            // Unexpected error stopped the login process
        } );

Or in future JS:
    const userinfo = await authPopup.startPopupWindow(); // etc.
    if ( userinfo ) {
        // Logged in
    } else {
        // Cancelled by the user
    }

In all three methods, the popup opens the login form with
&display=popup and with &returnto pointing to an unlisted special
page that communicates with the module on the parent page.

Once the library is stable, the AuthPopup component may be separated
from MediaWiki and released as its own package, to be used by tools
to open MediaWiki OAuth workflows in a similar way.

Bug: T364939
Change-Id: I08d9c799b8f79ebab2bcf4fcf330ee8eb995582e
2024-05-28 17:54:22 +00:00
Amir Sarabadani
9557ac076b rdbms: Introduce IDatabaseForOwner
Similar to LBForOwner, moving several internal methods there to fully
hide it from outside of rdbms.

Bug: T363839
Change-Id: I7a46d0e77d8865c6ed81ed351cb7fee0f9eda9cb
2024-05-24 11:37:08 +02:00
jenkins-bot
07ece77e44 Merge "Add MediaWiki\Watchlist namespace to the related classes" 2024-05-23 23:12:10 +00:00
jenkins-bot
7fc3b17a9e Merge "LoginSignupSpecialPage: Support &display=popup" 2024-05-23 16:03:19 +00:00
Bartosz Dziewoński
5623b2e44c LoginSignupSpecialPage: Support &display=popup
Setting this URL parameter will replace the default skin with a
"micro-skin" that omits most of the usual interface elements,
making the page suitable to be displayed in a small popup window.
Its design (such as it is) is mostly based on Vector 2022.

In the future, we might allow normal skins to serve this mode too,
if they advise that they support it by setting a skin option.
For now that is out of scope.

The login/signup process is otherwise completely normal. To make use
of it, launch the login page in a popup, and set &returnto=... to
redirect back to your own success page, which should communicate the
successful login to your app and then close itself.

The display=popup / display=page vocabulary is borrowed from the
OpenID Connect spec.

Bug: T362706
Change-Id: Ic7cbbe98344b25d2e965750e0c4429ce157163ed
2024-05-22 22:06:31 +02:00
Ebrahim Byagowi
12660db261 Add MediaWiki\Watchlist namespace to the related classes
This adds MediaWiki\Watchlist namespace to the classes of watchlist
directory and adds deprecation notice since 1.43 to the just created
unnamespaced aliases of the classes.

Bug: T353458
Change-Id: I4234f8fe62bb3bde6f5271c7ba31a2420b0f4b90
2024-05-22 01:23:10 +03:30
Ebrahim Byagowi
c556eda906 Add MediaWiki\Content namespace to FallbackContent{,Handler}
This adds MediaWiki\Content namespace to FallbackContent
and FallbackContentHandler and declares the unnamespaced version
as deprecated since version 1.43.

Bug: T353458
Change-Id: I3ee80aea379788b71539cc1c7a4ec216b753e042
2024-05-21 17:05:28 -04:00
jenkins-bot
31a72c9b71 Merge "REST: introduce OpenSearchDescriptionHandler" 2024-05-21 19:54:56 +00:00
Bartosz Dziewoński
2a6f12dd7d rdbms: Create RawSQLValue for SET clauses in update/upsert
Bug: T210206
Co-Authored-By: Umherirrender <umherirrender_de.wp@web.de>
Follow-Up: Ieb73d449262e22557f6f470105ca65ab0afc50e3
Change-Id: I18c6973713badd2b035aa7f44048344f3494b7b0
2024-05-21 19:16:16 +00:00
jenkins-bot
f7e88a336e Merge "Add MediaWiki\RevisionList namespace to the related classes" 2024-05-21 16:04:12 +00:00
Ebrahim Byagowi
656c7fac3b Add namespace and deprecation alias to JsonContentHandler
This patch introduces a namespace declaration for the
MediaWiki\Content to JsonContentHandler and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ia4ba6d3eddcb7b3f3d9f41a5ff80f724dbd01b22
2024-05-21 17:10:20 +03:30
Ebrahim Byagowi
64b7d2a03d Add MediaWiki\RevisionList namespace to the related classes
This patch introduces a namespace, MediaWiki\RevisionList, and adds it
to the related classes and establishes class aliases marked as
deprecated since version 1.43.

Bug: T353458
Change-Id: I1614a00dd8973c5300d95317a725cbe46e14d1af
2024-05-21 15:12:05 +03:30
jenkins-bot
37ae84be8b Merge "Add namespace and deprecation alias to WatchedItemStore" 2024-05-21 10:54:43 +00:00
jenkins-bot
7194dea853 Merge "Add namespace and deprecation alias to JsonContent" 2024-05-21 10:28:15 +00:00
jenkins-bot
8e4d1de473 Merge "Add namespace and deprecation alias to XMLRCFeedFormatter" 2024-05-20 17:36:04 +00:00
jenkins-bot
5ed6c68b58 Merge "Add namespace and deprecation alias to FileBackendGroup" 2024-05-20 17:35:54 +00:00
Ebrahim Byagowi
1be5d40e56 Add namespace and deprecation alias to FileBackendGroup
This patch introduces a namespace declaration for the
MediaWiki\FileBackend to FileBackendGroup and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Id33b6bfa56131978900199786b0082481c6c54a5
2024-05-20 20:06:00 +03:30
Ebrahim Byagowi
49fe440c63 Add namespace and deprecation alias to WatchedItemStore
This patch introduces a namespace declaration for the
MediaWiki\Watchlist to WatchedItemStore and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I820a3512440ba5a1de13e8470ccf5845918f3198
2024-05-20 19:14:17 +03:30
Ebrahim Byagowi
389b1d0436 Add namespace and deprecation alias to RefreshSecondaryDataUpdate
This patch introduces a namespace declaration for the
MediaWiki\Deferred to RefreshSecondaryDataUpdate and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I9ee3282918f8f3d444a12ca32434a15e93952055
2024-05-20 19:05:24 +03:30
Ebrahim Byagowi
8811183f85 Add namespace and deprecation alias to XMLRCFeedFormatter
This patch introduces a namespace declaration for the
MediaWiki\RCFeed to XMLRCFeedFormatter and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ibecca6307dce600040e50b4206c004ee38164b95
2024-05-20 18:58:20 +03:30
Ebrahim Byagowi
848a9f279f Add namespace and deprecation alias to JsonContent
This patch introduces a namespace declaration for the
MediaWiki\Content to JsonContent and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I44abb1ab5bd1fabf9886dc1457e241d7cae068bc
2024-05-20 18:57:07 +03:30
jenkins-bot
cd40801020 Merge "Add namespace and deprecation alias to UDPRCFeedEngine" 2024-05-20 14:13:04 +00:00
Ebrahim Byagowi
b557846a09 Add namespace and deprecation alias to UDPRCFeedEngine
This patch introduces a namespace declaration for the
MediaWiki\RCFeed to UDPRCFeedEngine and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I27437c2417984f21e29237b011add20cad9f4389
2024-05-20 06:38:25 +03:30
Ebrahim Byagowi
16197f7d76 Add namespace and deprecation alias to TextContentHandler
This patch introduces a namespace declaration for the
MediaWiki\Content to TextContentHandler and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I2c72dacf28ee72fb70b15acdd81d0eb717ea949a
2024-05-20 05:34:31 +03:30
jenkins-bot
5a74e8a7b6 Merge "Add namespace and deprecation alias to TextContent" 2024-05-20 00:47:30 +00:00
jenkins-bot
a66109fb5b Merge "Add namespace and deprecation alias to RedisPubSubFeedEngine" 2024-05-19 23:11:56 +00:00
jenkins-bot
430fcb026d Merge "Add namespace and deprecation alias to ActivityUpdateJob" 2024-05-19 23:06:47 +00:00
Ebrahim Byagowi
6e093bbe2d Add namespace and deprecation alias to MultiHttpClient
This patch introduces a namespace declaration for the
Wikimedia\Http to MultiHttpClient and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I4ebc1a3b496de08b2b430301da376578d13fcfe6
2024-05-20 00:32:45 +03:30
jenkins-bot
f9fc1d2668 Merge "Add namespace and deprecation alias to FileBackend" 2024-05-19 20:46:48 +00:00
Ebrahim Byagowi
97d1202784 Add namespace and deprecation alias to TextContent
This patch introduces a namespace declaration for the
MediaWiki\Content to TextContent and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ic251b1ddfcf6db9c85cb54cddf912aa827d2bc3a
2024-05-19 23:23:01 +03:30
Ebrahim Byagowi
d21cc67450 Add namespace and deprecation alias to FileBackend
This patch introduces a namespace declaration for the
Wikimedia\FileBackend to FileBackend and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Id897687b1d679fd7d179e3a32e617aae10ebff33
2024-05-19 22:35:58 +03:30
Ebrahim Byagowi
8aecf94da0 Add namespace and deprecation alias to ActivityUpdateJob
This patch introduces a namespace declaration for the
Wikimedia\Watchlist to ActivityUpdateJob and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I34342bb01c8f6c9657f1b2f05de1de64a107665f
2024-05-19 21:45:47 +03:30
Ebrahim Byagowi
f060e53ec0 Add namespace and deprecation alias to RedisPubSubFeedEngine
This patch introduces a namespace declaration for the
Wikimedia\RCFeed to RedisPubSubFeedEngine and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: If5b8a0b1f957e46f29907711079389fe543941d0
2024-05-19 21:38:22 +03:30
jenkins-bot
43cfa970e3 Merge "Add namespace and deprecation alias to MachineReadableRCFeedFormatter" 2024-05-19 15:32:02 +00:00
jenkins-bot
cc85512fbd Merge "Add namespace and deprecation alias to WatchedItemQueryServiceExtension" 2024-05-19 15:31:52 +00:00
Ebrahim Byagowi
fe4bbc8918 Add namespace and deprecation alias to WatchedItemQueryServiceExtension
This patch introduces a namespace declaration for the
MediaWiki\Watchlist to WatchedItemQueryServiceExtension and
establishes a class alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I65b414013291b0ca21288b70e29530bba3f7e22e
2024-05-19 17:42:59 +03:30