Commit graph

1802 commits

Author SHA1 Message Date
Giuseppe Lavagetto
61ed857f9e Refactor PublishStashedFileJob to make the code reusable
To this end, we create a trait to coalesce together all upload methods
common to all upload mechanisms.

Change-Id: I28d0be0239f3b25efc6ea8bc3d400b9d0f5bc7bf
2024-02-28 16:15:15 +01:00
jenkins-bot
8301b5ae7c Merge "specials: Use a pager on Special:UploadStash" 2024-02-25 16:20:19 +00:00
Timo Tijhof
be2dbcc219 ResourceLoader: Follow-up creation of ResourceLoaderEntryPoint
Follows-up Iadea44b7867f48a2be6ccbf00c0e56911a5af74e.

ResourceLoaderEntryPoint:
* Rename from Resource to ResourceLoader, as it is the entry point
  for ResourceLoader.
* Fix accidental use of ingroup on the file docblock
  instead of the class.
  https://phabricator.wikimedia.org/F42046908
* Fix broken "see" reference to "/load.php" on the ResourceEntryPoint
  class on doc.wikimedia.org. Files are indexed in Doxygen by full
  name without leading slash.
* Remove load.php from docgroup, akin to index.php.

tests:
* Remove unrelated Rest namespace from test suite.
* Remove redundant default values in newResourceLoader(),
  especially null values were confusing by showing an
  apparent intent to set a value without actually
  isplacing the default, given that isset/?? treat
  set null as not set.
* Simplify test by using the built-in startup module instead.

EntryPoint:
* Remove comment in test about doPostOutputShutdown.
  It sounded like it was explaining that we use getCapturedOutput()
  instead of run() because the latter calls doPostOutputShutdown
  which we want to avoid. Except, we don't avoid it,
  since run() is called and does call doPostOutputShutdown.
  Unclear what it was explaining.
* Improve docs around getCapturedOutput() in the base class,
  and make explicit that this seemingly unused complexity
  exists for the purpose of testing.

Bug: T354216
Change-Id: I5139fda90a3d5ac7ea1ed917c8045d1a09961d78
2024-02-22 22:30:39 +00:00
jenkins-bot
02990a13e0 Merge "SpecialRandomPage: Remove deprecated stuff" 2024-02-20 17:54:35 +00:00
Reedy
24260fe527 SpecialPrefixIndex: Allow extensible filters
Add SpecialPrefixIndexGetFormFiltersHook hook that allow extensions
to add custom filters on Special:PrefixIndex and another hook
SpecialPrefixIndexQuery that allows you to modify the query builder
to add more conditions based on the filters selected.

Bug: T299308
Change-Id: Iabc672086547d0b19f01cc95892633c2668821ef
2024-02-18 16:43:43 +05:30
Fomafix
83e57d0444 SpecialRandomPage: Remove deprecated stuff
* Constructor without injected services.
* Class name alias RandomPage.

The class name SpecialRandomPage can removed in 1.43.

Accoding to
https://codesearch.wmcloud.org/search/?q=RandomPage
there is no usage with the old class names or without injected
services.

Bug: T265308
Depends-On: I889266c7b1435c6849a63fa5d99f272c9650e96a
Change-Id: I9ae2655084128ff5e9531f4d4431cab966c72341
2024-02-17 20:52:42 +00:00
Subramanya Sastry
e55cc517da Move Parser to Mediawiki\Parser namespace
Bug: T166010
Co-Authored-By: Daimona Eaytoy <daimona.wiki@gmail.com>
Co-Authored-By: James Forrester <jforrester@wikimedia.org>
Co-Authored-By: Subramanya Sastry <ssastry@wikimedia.org>
Change-Id: I79b4e732c45095eedbaa80afa5eb7479b387ed8a
2024-02-16 09:18:38 -05:00
C. Scott Ananian
b01eb624c4 [OutputTransform] Add section edit links to Parsoid output
Bug: T269630
Change-Id: I9d5fb6348609642ad94743cc5dae81ce608be99d
2024-02-15 13:09:02 -05:00
Umherirrender
1175c77fca specials: Use a pager on Special:UploadStash
- A pager allows to limit the result shown on the page
- A pager allows pagination if the list is very long
- Add timestamp, thumb and dimensions to provide more information

Bug: T335629
Change-Id: I30b6cbe11f116baad4f61a08876f18f5d042ac02
2024-02-14 21:13:56 +01:00
James D. Forrester
eeb5a740b3 Namespace Message, move to appropriate directory
Bug: T353458
Change-Id: I088cbc53fbcdb974e5b05b45a62e91709dacc024
2024-02-14 15:10:36 -05:00
James D. Forrester
59c0aa2134 Namespace HTMLForm and friends
Bug: T353458
Change-Id: I09e66c3223018ec47e0549ee7f6a590b676f4eef
2024-02-14 08:18:33 -05:00
C. Scott Ananian
4c302bd47c Move hooks used by OutputPage into includes/Output/Hook
Bug: T166010
Change-Id: Ifdb9e6b59f126b47e4143c875c34a207643b7034
2024-02-09 11:08:43 -05:00
James D. Forrester
4bae64d1c7 Namespace includes/context
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
2024-02-08 11:07:01 -05:00
Amir Sarabadani
686ab5623a LinkedData: Namespace PageDataRequestHandler
Bug: T353458
Change-Id: I873c323bc94e6ff6c07bbbe6157fc4cdf0e85e0d
2024-02-08 11:07:01 -05:00
C. Scott Ananian
52320c0902 Move ParsoidRenderID to MediaWiki\Edit
This class belongs with the rest of the Parsoid output stash code.

This class has been marked @unstable since 1.39 and thus the move
does not need release notes.

Change-Id: I16061c0c28b1549fbe90ea082cc717fee4a09a6e
2024-02-07 21:22:06 -05:00
Isabelle Hurbain-Palatin
ec9dc3d4c4 Rename PostCacheTransformHookRunner
Follow-up to I53551ec6d6471569709c71c1155729e550f64de8.

Bug: T348253
Change-Id: Ia08624a6770070313bf8bbaa11df29e4ed30b73b
2024-02-07 13:01:20 -05:00
jenkins-bot
77e88d6821 Merge "ResourceLoader: Factor out ResourceEntryPoint from load.php" 2024-02-02 22:31:37 +00:00
jenkins-bot
d023c7fb99 Merge "Move creation of BlockErrorFormatter into FormatterFactory" 2024-02-02 22:29:47 +00:00
daniel
4ea8c705a3 ResourceLoader: Factor out ResourceEntryPoint from load.php
The idea is that all entry points should share the code in the
MediaWikiEntryPoint base class. This change by itself doesn't achieve much, it should be followed up by a change moving request handling logic from ResourceLoader into ResourceEntryPoint.

Bug: T354216
Change-Id: Iadea44b7867f48a2be6ccbf00c0e56911a5af74e
2024-02-02 17:06:31 -05:00
jenkins-bot
3638503d48 Merge "Move code from api.php into ApiEntryPoint class" 2024-02-02 20:24:22 +00:00
jenkins-bot
bf22917ed1 Merge "entrypoint: Isolate entry points from PHP runtime for testing" 2024-02-02 19:59:11 +00:00
daniel
d79af914ff Move code from api.php into ApiEntryPoint class
The goal is to unify the high level control flow in entry points by
making them use a shared base class. Eventually, this will allow
us to test all aspects of request handling, including response
headers and output buffer handling. That will however require
us to move quite a bit of logic from ApiMain into ApiEntryPoint.

Bug: T354216
Change-Id: I4ea1cbb8b2786c24deade7d5029d95fe0c2abc57
2024-02-02 19:27:53 +00:00
daniel
24d0aee05e entrypoint: Isolate entry points from PHP runtime for testing
1) Introduce EntryPointEnvironment which wraps functions that interact
with the PHP runtime, so they can be mocked for testing.

2) Allow server info fields to be overwritten in FauxRequest.

3) Make MediaWikiEntryPoint use WebResponse to set headers

Bug: T354216
Change-Id: Ic21950c956de5d2b5a7dd66a1e2de58f807cfd9f
2024-02-02 13:03:29 +01:00
James D. Forrester
21d8d9863b Drop old ResourceLoader class aliases, deprecated since 1.39
Depends-On: Iff15a2e13a3507ef1ab5cfa504ca1a1c8d2b2a60
Depends-On: Icf8331e35acf6fe51a8303ee639921b9e4f3e6bb
Depends-On: I5a5af003026db69b279ddde0b0dedbfcfe7d70fd
Change-Id: I5929a2f760c8d21c1cb2542a19220a91ac7240e4
2024-01-31 18:24:37 -05:00
Bartosz Dziewoński
5cb8e2da1e Add maintenance script to list users with invalid signatures
Bug: T356168
Change-Id: I2a6dd189d41e6f85d103965eb2e826cca5b2b375
2024-01-30 11:25:43 +00:00
jenkins-bot
9db4dbf46d Merge "Add a maintenance script to populate user_is_temp column" 2024-01-29 15:32:58 +00:00
daniel
3d55397207 Move creation of BlockErrorFormatter into FormatterFactory
The idea is that all formatters that need the user language or
other request specific context should be instantiated by
FormatterFactory.

Change-Id: I8334cc89dcf0f293298b82e004116be50a90f0d1
2024-01-26 13:03:44 -05:00
Reedy
5a324df8ae Stop supporting composer 1.x
Bug: T316558
Change-Id: Ie512b43a601502deb50de24e1f3efc45b0223ced
2024-01-24 22:19:38 +00:00
Dreamy Jazz
6487791074 Add a maintenance script to populate user_is_temp column
Why:
* The user_is_temp column exists in the user table to allow finding
  temporary users when reading from the DB directly.
* This column was added in f283c0e990,
  but this was not written to until
  6e68107b3a which was several months
  later and after a release version was branched.
* As such, we need a maintenance script to populate the user_is_temp
  column for wikis that have enabled temporary account creation.

What:
* Add a maintenance script named populateUserIsTemp.php which
  populates the user_is_temp column by looking for rows in the
  user table that have user_is_temp as 0 and have user_name match
  at least one temporary account match pattern. These rows are then
  updated to have user_is_temp as 1.
* This script will be added to update.php in a future commit, so that
  betawikis can have this run manually.
* Create unit tests and an integration test for this maintenance
  script.

Bug: T355181
Change-Id: I6223496d7aee65e3ab207fe86e386b01bef8b388
2024-01-24 14:16:39 +00:00
jenkins-bot
4ce5d3e207 Merge "LocalisationCache: Update references to globals / main config" 2024-01-19 19:15:07 +00:00
Timo Tijhof
4ee45454a9 ResourceLoader: Remove libs/jsminplus.php (JSMinPlus, JSParser)
No longer used.

Bug: T75714
Change-Id: I2b097671716fabec169bc803da98cd0340d70cc4
2024-01-19 05:07:23 +00:00
Daimona Eaytoy
4be770a196 Deprecate and replace the wfUnpack global function
Move it to the StringUtils class, and make it throw a dedicated
exception. Update code in media/ to use the new method. Those seemed to
be the only usages across all known MW code [1], so hard-deprecate the
method as well.

[1] - https://codesearch.wmcloud.org/search/?q=wfUnpack&files=&excludeFiles=&repos=

Change-Id: I82ce96b6373443cf57a48b98595ca05290f37349
2024-01-17 21:17:24 +00:00
Bartosz Dziewoński
2b0edb46ac Remove unused UploadChunkZeroLengthFileException
Added in 0095c08ed2 / r104687 (2011),
it has never been used (not even in that commit).

Change-Id: I7cfcbc6a6d3ce20aa4052904116ef72bec7faf6e
2024-01-17 04:32:35 +01:00
jenkins-bot
4f597ef592 Merge "installer: Namespace remaining classes" 2024-01-14 04:29:50 +00:00
jenkins-bot
7e98d481cf Merge "installer: Namespace more installer classes" 2024-01-14 04:29:42 +00:00
Reedy
1c0692d19e installer: Namespace remaining classes
Change-Id: I11a8df30a2117ef29a4ade25f1082f25eb18490a
2024-01-13 23:45:14 +00:00
Reedy
8600ee105c installer: Namespace more installer classes
Change-Id: If58d96c311bef728446b517bb7a81316b23aad4d
2024-01-13 23:42:08 +00:00
Reedy
72df6cb8da libs/composer: Namespace under Wikimedia\Composer
Change-Id: I5ffedacf31e60fb0f38e308f8dcf010e577f919e
2024-01-13 20:10:25 +00:00
Reedy
6000befd1e composer: Namespace Composer classes
Change-Id: I0ae0041ff4929b6791e03cfb8c73f422076125c6
2024-01-13 19:15:16 +00:00
RazeSoldier
20e77793b8 Refactor checkComposerLockUpToDate.php logic out to reuseable class
Introduce LockFileChecker that used to check whether
composer-installed dependencies (no-dev) are up-to-date.

Bug: T283389
Change-Id: I0d56f235604d5c856bae5d170230f8c7ca0729c6
2024-01-13 18:35:07 +00:00
jenkins-bot
9ba2b79a5b Merge "Namespace WebInstaller classes" 2024-01-12 01:23:25 +00:00
Reedy
29b4540718 Namespace WebInstaller classes
Change-Id: Iac081a08681048c56b20c7789c5efb50a756d167
2024-01-11 23:29:14 +00:00
MusikAnimal
4e42654329 MigrateBlocks: maintenance script for migrating to multiblocks schema
The old ipblocks table is left touched.

The data is normalized to match the new schema, including resolving
any data integrity issues with ipb_parent_block_id (T282890).

Data is not validated as it is copied. Existing logic could be used from
DatabaseBlockStore, but it performs other non-idempotent actions, and
would probably slow down the script.

The default batch size is 500 instead of the typical 1000 because two
INSERTs are performed for each ipblock.

Bug: T350361
Bug: T282890
Change-Id: I526bb9b8febc5c1cb6a56b9a1044dedcf99c2224
2024-01-11 14:45:29 +11:00
jenkins-bot
7057d995bc Merge "Add support for conditional user defaults" 2024-01-09 04:42:53 +00:00
Martin Urbanec
6c8b696020 Add support for conditional user defaults
Why:
Sometimes, it is necessary to have different behavior
for newly registered and existing users. For example,
this happens in the Echo or GrowthExperiments extensions.
As of now, this behavior is implemented by inserting
user_properties rows in onLocalUserCreated.

Over time, this results in a singificant amount of rows
inserted, which contributes to the user_properties table bloat,
which is already overly large (cf. T54777). This patch makes it
possible to remove such rows by supporting conditional defaults
for user properties.

What:
Add support for conditional defaults of user properties. This can be
configured via `ConditionalUserOptions` config option.

Bug: T321527
Change-Id: I1549c3137e66801c85e03e46427e27da333d68e2
2024-01-09 02:33:17 +00:00
jenkins-bot
8901f72e23 Merge "Introduce MediaWikiEntryPoint and ActionEntryPoint" 2024-01-05 02:56:40 +00:00
Alexander Vorwerk
fd77427f47 Make BlockUtils a wiki-aware service
Bug: T353620
Bug: T354298
Change-Id: I46699071bbdbbde650061dece6b67a0c58444523
2024-01-03 20:05:40 +01:00
daniel
a4853b0aa5 Introduce MediaWikiEntryPoint and ActionEntryPoint
This extracts the MediaWikiEntryPoint base class and ActionEntryPoint
class from the MediaWiki class. MediaWiki itself be deprecated.

The intent is to create other subclasses of MediaWikiEntryPoint for the
use by other entry points such as thumb.php or api.php. This will allow
us to share code between entry points, and make these entry points
testable by moving their implementation into a class.

Bug: T354216
Change-Id: Ib70e4e67e4cb1b65ac218c095864fb6eb43d0929
2024-01-03 19:20:44 +01:00
Reedy
e28d15e8ce Fix capitalisation of MediaWiki\OutputTransform namespace
It was using Mediawiki not MediaWiki

Follows-Up: Ibc46c34072eadb3e84f69df49a3a424f3864c952
Follows-Up: I53551ec6d6471569709c71c1155729e550f64de8
Change-Id: Ia37a6330d64c3179d7abc12ec3f6fc7daca2e371
2024-01-02 03:03:14 +00:00
Kosta Harlan
69f7b06143 maintenance/version: Namespace and rename
Why:

- PHPUnit errors when running locally (T353873)

What:

- Add Maintenance namespace to script
- Make uppercase to match convention for other classes

Bug: T353458
Bug: T353873
Change-Id: I3d2200ee9b53f45d39e7f7b143f1128b2d855849
2023-12-21 11:50:44 +00:00