Commit graph

1584 commits

Author SHA1 Message Date
DannyS712
07af42e199 Add DeferredUpdatesManager service to replace DeferredUpdates
This patch doesn't deal with the injection of dependencies
and removal of the global state, but rather moves the code
from DeferredUpdates to the new service essentially as-is,
to simplify review. The changes to inject the various
services needed and make DeferredUpdatesManager a proper
service will be done in follow-ups, to make them easier
to follow.

While almost everything is changed from static to non-static,
DeferredUpdates::$scopeStack remains static as
DeferredUpdatesManager::$scopeStack, just in case multiple
versions of the service are created, to ensure that no
updates are missed.

Bug: T265749
Change-Id: I7f07eddf2fc399b15db4fe9be4c792ef8eb0747b
2023-05-29 03:59:03 +00:00
James D. Forrester
27bd40d679 Namespace SpecialMy* under \MediaWiki\Specials\Redirects
Change-Id: I1c4473b3c75a4a5095b26d825b1f2f1f093d728a
2023-05-21 13:16:04 +03:00
James D. Forrester
c6eadd8d32 Namespace SpecialM* under \MediaWiki\Specials
Change-Id: I3f733dcef861f26e0938185605f88c0e316a9291
2023-05-21 12:07:04 +03:00
Liangent
504c1a9faf Implement Language Converter for yue (Cantonese)
This only implement unidirectional yue-Hant => yue-Hans per community consensus.

Bug: T59106
Change-Id: Iee936baa0a42370a723b34b09a791bf0917dcdf4
2023-05-20 16:11:11 +00:00
Lt2818
e69ed0fee9 Implement Language Converter for wuu (Wu)
Bug: T59138
Change-Id: I62507198ad4e467bf4c09f3545ce77188f47903e
2023-05-20 15:14:41 +00:00
jenkins-bot
db3053faf6 Merge "Introduce ChangeTagsStore service and move some functions of ChangeTags" 2023-05-19 08:58:27 +00:00
Samtar
2ba3afbd47
Revert "diff: Add legend and tooltips to inline diff display"
This reverts commit 19eb61de66.

Reason for revert: Reworking

Change-Id: I2bc524254d10d6612c5b0a7db95dd6af5f60ccaa
Depends-On: I5c3d7df530eb6fc09ba380d42a81b17511861308
Depends-On: I60784afa0d47e22acd9e8a981092784c84b250eb
2023-05-18 15:50:59 +01:00
Func
942d288f52 Implement HTMLToggleSwitchField for mobile layout of preferences
This is the more native way of doing things, which avoids syncing
different states between the toggle and the hidden widget.
The DOM structure is also better and don't confuse screen readers.

Bug: T333496
Bug: T334705
Bug: T336107
Change-Id: I47de69459b96f172153065094eb4113584bb435a
2023-05-18 02:23:28 +08:00
Bartosz Dziewoński
6a20dc29ae editpage: Split off producing edit intro messages and preloaded content
Introduce two new classes, containing code split off from EditPage:
* IntroMessageBuilder (edit notices and other intro messages)
* PreloadedContentBuilder (initial text of new pages / sections)

I'm doing both of these features in one change, because they share a
lot of code. They are meant to be used by alternative editors to
support all of the features of the MediaWiki edit form. This isn't
everything you need yet (we should at least do this for the edit
checkboxes too), but it's a step.

Bug: T201613
Change-Id: If0b05710cb52a977bf4e85947d72d68683a0a29e
2023-05-16 20:51:00 +02:00
Amir Sarabadani
b5ccd131d6 Introduce ChangeTagsStore service and move some functions of ChangeTags
Better DI, cleaner code, etc.

Way more needs to be moved but let's avoid exploding the patch.

Bug: T245964
Change-Id: I63b0f60187250fabf4d17c80a794877f07d2b1a2
2023-05-16 16:25:44 +01:00
Umherirrender
11d4d33e08 Remove deprecated WatchlistNotificationManager class alias
- class MediaWiki\User\WatchlistNotificationManager
- MediaWiki\MediaWikiServices::getWatchlistNotificationManager

Change-Id: I334f10e814b2bf9ef3de6f6ea3ed5ae4ad402ae0
2023-05-13 09:55:45 +02:00
jenkins-bot
c349002235 Merge "ResourceLoader: Allow FileModule scripts to be generated with a callback" 2023-05-10 02:19:38 +00:00
jenkins-bot
acfd4540b5 Merge "maintenance: Rename generateLocalAutoload to generateAutoload" 2023-05-09 16:01:58 +00:00
Tim Starling
a59c446154 ResourceLoader: Allow FileModule scripts to be generated with a callback
To implement source maps, we want FileModule::getScript() to return
an array with path information, but that would break subclasses of
FileModule which concatenate to the return value of parent::getScript().
So allow scripts to be generated by a callback, eliminating the need for
concatenation in subclasses.

* Factor out most of the loop body of expandPackageFiles() into
  expandFileInfo(). Add 'name' to the return value. Ensure 'filePath'
  is always a FilePath object since we need that to safely return it
  to ResourceLoader later. Document the return value.
* Make sure the base path is always set in FilePath objects returned by
  expandFileInfo().
* Factor out the loop body of the final stage of file info expansion
  into readFileInfo(). Retain filePath, do not unset it.
* Assert that $fileInfo['content'] is definitely set.
* Convert array_map() in getDefinitionSummary() to a loop.
* Migrate LanguageDataModule.

Bug: T47514
Change-Id: I97d61b5793159cea365740e0563f7b733e0f16de
2023-05-09 11:47:40 +10:00
jenkins-bot
a697d50bcb Merge "rdbms: Move ReadOnlyMode and ConfiguredReadOnlyMode to rdbms library" 2023-05-05 00:15:27 +00:00
Amir Sarabadani
623d3dc419 rdbms: Move ReadOnlyMode and ConfiguredReadOnlyMode to rdbms library
The db/ directory does not have an owner and it's a mess in general.
These classes don't depend on anything in core except the rdbms library.
Let's simply move it there. In other words, Krinkle made me do it.

Since the class was moved in I6202e52ba73 merged less than a week ago,
no need to alias anything.

Bug: T321882
Change-Id: I24ceeb8bf765a50f441270136acd612359d50aa2
2023-05-04 23:41:21 +02:00
James D. Forrester
711295fb5d Namespace SpecialL* under \MediaWiki\Specials
Plus two redirect specials.

Change-Id: Ie56f96894f6bfbdb9bc093fce8b72b18f8adce86
2023-05-04 19:27:38 +00:00
James D. Forrester
246b9b97fe Namespace SpecialJavaScriptTest under \MediaWiki\Specials
Change-Id: I3da3b343b52c27ccef619194132c70bb23e06aea
2023-05-03 21:08:57 +00:00
James D. Forrester
07ae8aaa00 Namespace SpecialImport under \MediaWiki\Specials
Change-Id: I8b4cd11481d2be9aac6f6bd6c0bc45d6f8edc5ce
2023-05-03 17:08:41 -04:00
James D. Forrester
32ded76880 Namespace SpecialGoToInterwiki under \MediaWiki\Specials
Change-Id: I69da6a04e9e9b47fec026d4d9d937eb28342128d
2023-05-03 20:02:49 +00:00
James D. Forrester
7107f76fab Namespace SpecialF* under \MediaWiki\Specials
Change-Id: I754866a2b2343c9ba276de5cf5766961c0aa20c5
2023-05-03 20:02:17 +00:00
James D. Forrester
727b29f434 Namespace SpecialE* under \MediaWiki\Specials
Change-Id: Id456f920654bcf179b6ae24bdb061d58bcd5be33
2023-05-03 17:03:00 +00:00
James D. Forrester
920a37c6ee Namespace SpecialD* under \MediaWiki\Specials
Change-Id: I665da4326348e16e6ebc20780a351c6701c4fe40
2023-05-03 06:17:08 +00:00
James D. Forrester
833ba2a3fd Namespace SpecialC* under \MediaWiki\Specials
Change-Id: Idbdacc20d45437d141c1a0d5f2eee98ae9345875
2023-05-03 06:15:57 +00:00
jenkins-bot
192bccb526 Merge "rdbms: Introduce Query object" 2023-04-29 15:56:06 +00:00
jenkins-bot
4445692e34 Merge "rdbms: Introduce DeleteQueryBuilder" 2023-04-28 23:02:45 +00:00
Amir Sarabadani
9e6fa0d225 rdbms: Introduce Query object
An interesting portion of rdbms is building SQL and then trying to
reverse engineer what tf the given SQL is doing, whether it's a write
query or not, whether it's writing to temp tables, etc.

Let's just pass around the actual data instead.

Bug: T326181
Change-Id: I4d7c72c08c98b884de51b46abf6460229055dcc9
2023-04-28 23:44:38 +02:00
jenkins-bot
ddc1cfc94e Merge "Reorg: Move ReadOnlyMode classes to db/" 2023-04-28 19:26:29 +00:00
Amir Sarabadani
d59ffa4202 Reorg: Move ReadOnlyMode classes to db/
They are not suitable to go to rdbms library as they depend on mediawiki
pieces, the second best place is the db/ directory.

Bug: T321882
Change-Id: I6202e52ba7306d74261206c2ba7930c5f1a0a18e
2023-04-28 12:13:01 +02:00
Sam Wilson
19eb61de66 diff: Add legend and tooltips to inline diff display
Add a legend at the top of the inline diff display, showing the
meanings of the colours of the inserted and deleted highlighting.
Also add the same text as tooltips on the highlighted elements.

The legend is added as part of a new area above the diff table
that can be modified via a new DifferenceEngineBeforeDiffTable
hook, so that extensions can add other buttons etc. there as
required.

Bug: T324759
Change-Id: I6de30bf79eb5ac262285951792782b870d075e00
2023-04-28 11:27:10 +08:00
Amir Sarabadani
e182010622 Reorg: Move SiteStats*.php to SiteStats/
It's going to be a bit small and narrow but it's better than sitting in
the root of includes/ plus I hope we can hollow out SiteStatsUpdate
class into the third one and or move this under a better directory in
the future.

Bug: T321882
Change-Id: Ia503b53b31ca00600f8c18b61a2652c3e146494e
2023-04-27 01:16:29 +02:00
Amir Sarabadani
1d803c3db5 rdbms: Introduce DeleteQueryBuilder
Similar to the rest of query builders

Bug: T335378
Change-Id: I61151bfa33798c0a28e94b27e88e7b00471d9131
2023-04-26 10:03:46 -04:00
jenkins-bot
129f9ac571 Merge "Remove deprecated class Http" 2023-04-24 21:02:12 +00:00
Umherirrender
4a1479c9cc Remove deprecated class Http
The class and all functions are deprecated:
- Http::request()
- Http::get()
- Http::post()
- Http::userAgent()
- Http::isValidURI()
- Http::getProxy()
- Http::createMultiClient()

Bug: T305813
Change-Id: Icd8af4822b16b4bf4558b756e20171c3ae9a9fa1
2023-04-24 21:52:32 +02:00
Amir Sarabadani
e06f77134d ExternalLinks: Add function for looking up extlinks of a page
This logic has been repeated in three different extensions, let's DRY
them up.

Bug: T326251
Change-Id: I8ae9ef388957b0c04efa281f3bc3b5796bec17fe
2023-04-24 19:55:57 +02:00
Amir Sarabadani
ab21d8fef9 Reorg: Move Emptiable to libs/
It doesn't depend on anything, it's more suitable for libs/

Bug: T321882
Change-Id: Ia12306fd1f8c99f1ba78672e3ff162ffeb99d491
2023-04-20 18:55:48 +02:00
Amir Sarabadani
5ee167488c Reorg: Move MediaWikiVersionFetcher to composer/
There is a dedicated directory for this. It should go there.

Since it's not really part of MW, there is no sense in making it
namespaced (doubly so with MediaWiki\). The whole thing should be
removed.

Bug: T321882
Change-Id: I18d7a7542d9445be535e6aa535c68759682a115e
2023-04-20 18:54:05 +02:00
daniel
f3007f3719 maintenance: Rename generateLocalAutoload to generateAutoload
This also makes generateAutoload work with maintenance/run.

Change-Id: I431ba0c3af83ffe0f1df457c7640b1a187048418
2023-04-20 18:46:02 +02:00
jenkins-bot
78a7e31dc0 Merge "Add Hook suffix to ParserModifyImageHTMLHook" 2023-04-17 15:37:22 +00:00
Umherirrender
95814d8d6f Add Hook suffix to ParserModifyImageHTMLHook
Common naming convention for hook runner interfaces

Bug: T334689
Change-Id: I3043454a502289e5ee2492f7bf2ab01e155c30ba
2023-04-16 19:32:48 +02:00
Umherirrender
033e75cb26 Add Hook suffix to GetBlockErrorMessageKeyHook
Common naming convention for hook runner interfaces

The hook is new in 1.40 and the rename should be backported,
but the old name needs alias as it is already used in extensions.

Bug: T334689
Change-Id: I3f9e6d33f1bf29e937c82860fcebd088dde647da
2023-04-16 17:28:13 +00:00
jenkins-bot
5e704016a9 Merge "re-apply "mergeMessageFileList.php: move code out of file scope."" 2023-04-12 09:20:15 +00:00
Daniel Kinzler
9e708cece7 re-apply "mergeMessageFileList.php: move code out of file scope."
This reverts commit 683cd2f4d7
to restore I349ef565a7c08f90a75b0fc6db49f030cb56f6cf.

Reason: fixed a typo that led to message dirs being ignored:
The correct name of the setting is "wgMessagesDirs", the original
patch had "wgMessageDirs".

I confirmed locally that the new version produces the same output
as the old.

Change-Id: I32f45438ba37ed08075aadc9b1d83db88ca5f014
2023-04-12 10:31:15 +02:00
Amir Sarabadani
d183a8e009 rdbms: Introduce UnionQueryBuilder
To get rid of a lot logic duplication and direct calls to
IDatabase::query()

Bug: T333690
Change-Id: I14093100153c91baadf76c41b0dd4b896e77d222
2023-04-12 01:45:09 +02:00
James D. Forrester
93f9b68152 Namespace SpecialB* under \MediaWiki\Specials
Change-Id: I49dbfbfae543e490b468da36efe06123ff60ffa2
2023-04-02 14:59:04 +00:00
C. Scott Ananian
cfd9c516e1 Allow setting a ParserOption to generate Parsoid HTML
This is an initial quick-and-dirty implementation.  The
ParsoidParser class will eventually inherit from \Parser,
but this is an initial placeholder to unblock other Parsoid
read views work.

Currently Parsoid does not fully implement all the ParserOutput
metadata set by the legacy parser, but we're working on it.

This patch also addresses T300325 by ensuring the the Page HTML
APIs use ParserOutput::getRawText(), which will return the entire
Parsoid HTML document without post-processing.  This is what
the Parsoid team refers to as "edit mode" HTML. The
ParserOutput::getText() method returns only the <body> contents
of the HTML, and applies several transformations, including
inserting Table of Contents and style deduplication; this is
the "read views" flavor of the Parsoid HTML.

We need to be careful of the interaction of the `useParsoid` flag with
the ParserCacheMetadata.  Effectively `useParsoid` should *always* be
marked as "used" or else the ParserCache will assume its value doesn't
matter and will serve legacy content for parsoid requests and
vice-versa.  T330677 is a follow up to address this more thoroughly by
splitting the parser cache in ParserOutputAccess; the stop gap in this
patch is fragile and, because it doesn't fork the ParserCacheMetadata
cache, may corrupt the ParserCacheMetadata in the case when Parsoid
and the legacy parser consult different sets of options to render a
page.

Bug: T300191
Bug: T330677
Bug: T300325
Change-Id: Ica09a4284c00d7917f8b6249e946232b2fb38011
2023-03-26 21:46:05 -04:00
jenkins-bot
42b9f46c14 Merge "profiler: Add ProfilingContext class" 2023-03-23 00:23:58 +00:00
Aaron Schulz
29bab859fc profiler: Add ProfilingContext class
Use this class to track the entry point and handler used for requests,
making it available for use in profiling, stats, and logging code.

This makes it possible for periodic and/or shutdown profiling callbacks
to know the basic action handler that applies to the request (if any).
Metric names can easily include this string along with MW_ENTRY_POINT
to create per-action profiling dashboards.

This info cannot otherwise be acquired from things like excimer stack
traces since the router and handler classes do not appear in the stack
during PRESEND deferred updates and variations like ApiMain/SpecialPage
"inclusion mode" would have to be detected somehow.

Bug: T330810
Change-Id: Icca5a7a343faeeb18652994c96752acb61a61fd1
2023-03-23 00:08:49 +00:00
Bartosz Dziewoński
1e86517db5 Remove deprecated pager methods/classes
Deprecated in MW 1.39:
* Ic75bd597b210e14612ca3aebb531b659897e8294
* I4e2f36b543462aa5d852733da650fb70d49ebf06

Hard-deprecated in MW 1.40:
* I09e9203b19e3808af9348db8a889d5e118282230

Change-Id: I17bd8f80e87a04674e826d7966aa3ddb011fc7ba
2023-03-22 15:23:56 +00:00
James D. Forrester
d933d5fcfa Namespace SpecialA* under \MediaWiki\Specials
So begins a series of patches. :-)

Change-Id: I88cb6304e2d1d2e59bd316b6fc181ab7f323e707
2023-03-17 17:42:39 -04:00