Commit graph

1713 commits

Author SHA1 Message Date
jenkins-bot
13c7f7d56f Merge "Add ApiCreateTempUserTrait for APIs that create temporary users" 2023-11-02 19:55:31 +00:00
Thalia
9396cd6eed Add ApiCreateTempUserTrait for APIs that create temporary users
Refactor EditPage's logic for getting a redirect URL into a trait
that can be shared between classes that exteend ApiBase.

Bug: T349223
Change-Id: I7cafa0bfc17a75d44e1d83b9561b4b2778b5f132
2023-11-01 13:29:02 +00:00
Amir Sarabadani
f64db42f62 rdbms: Drop some of class aliases of DatabaseMySQL
They were supposed to be dropped before 1.41 release.

Depends-On: Icd972535725e65e6eaed25607f1fd1c69d6b3a5c
Change-Id: Ieeaf39ec07407a55daa51c350cd57b66283a27bb
2023-10-31 23:18:21 +00:00
daniel
04197cb13f Introduce StatusFormatter
This takes us one step closer to deprecating Status,
so we can isolate StatusValue from presentation logic.

FormatterFactory is introduced as a mechanism for
getting instance of formatters that need access to the user interface
language and other request dependent information.

Usage is demonstrated in thumb.php, SpecialCreateAccount, and
SearchHandler. The examples indicates that there is no work do
be done around ErrorPageError and LocalizedHttpException.

Change-Id: I7fe5fee24cadf934e578c36856cc5d45fb9d0981
2023-10-27 14:56:51 +02:00
Derick Alangi
5bca452be3
lib/virtualrest: Drop the virtualrest library
Code is no longer used and all previous usage has been replaced
with the appropriate HTTP logic and cleanup has been taken care
of.

As a follow-up to this patch, I'll be finally removing the
`$wgVirtualRestConfig` setting from core and extensions.

Bug: T338921
Change-Id: I7e1fff996033ba26e1b3dd229dd299a64c610707
2023-10-23 11:02:59 +01:00
jenkins-bot
49859c6bd4 Merge "rdbms: Introduce expression builder" 2023-10-20 20:49:27 +00:00
Amir Sarabadani
3ef6662f31 rdbms: Introduce expression builder
To avoid accepting raw SQL in conditions and avoid the need to call to
addQuotes() which might get forgotten and open a SQL injection vulnerability.

A migration path would be something like the following:

Before:
'rev_timestamp > ' . $db->addQuotes( $timestamp )
After:
$db->expr( 'rev_timestamp', '>', $timestamp )

See the ticket for more information and reasoning.

Bug: T210206
Change-Id: I72431410c21ab97e797c7df07bf0dedd19307e65
2023-10-20 20:15:55 +00:00
Tim Starling
69e8a152d5 Remove UserRightsProxy
And have UserGroupManagerFactory cache instances, per the TODO.

I'm doing this because SpecialUserRightsTest was flaky when there are
two local instances of UserGroupManager floating around. Resolving the
todo is the simplest way to ensure there is only a single
UserGroupManager. There are no remaining usages of UserRightsProxy in
codesearch.

Change-Id: Icb3395dfc53a4441b667f001ac1227f36d1f2e8d
2023-10-20 10:10:24 +11:00
Isabelle Hurbain-Palatin
36b4ab44f6 Refactor ParserOutput::getText into DefaultOutputTransform service
This also introduces the ephemeral field "$mTransformedText" to store
the result of transformation in ParserOutput.

This is a first step before the transformation uses HtmlHolder as input
and output.

Bug: T348253
Change-Id: I312f3748ebfb0373ee3542ba0abdeefe7db1d488
2023-10-16 13:11:38 +02:00
Tim Starling
03ceb372b3 Add cache to BlockManager
Add a cache to BlockManager, so that we can get rid of the block cache in
User.

The cache stores up to three blocks -- a request block, a user block and
an anonymous (IP) block. Using object identity to compare keys means
that we can avoid serializing the WebRequest and UserIdentity.

Bug: T345683
Change-Id: I7639766519861690a759629144c8680767539293
2023-10-12 13:42:58 +11:00
jenkins-bot
e8340a75c7 Merge "Remove deprecated interface ParserTestTablesHook" 2023-10-03 20:11:04 +00:00
jenkins-bot
aa5008f24e Merge "ResourceLoader: Improve and generalize validateScriptFile test coverage" 2023-10-03 19:33:52 +00:00
Umherirrender
42152f5fb4 Remove deprecated interface ParserTestTablesHook
The hook is no longer called, so the deprecation warning of the
HookContainer (as mention in DeprecatedHooks) cannot work as expected.

Change-Id: Idb586e9c2d8ba87411acc137537db6d6c75485a7
2023-10-03 19:52:49 +02:00
jenkins-bot
c7fe8a109d Merge "Revert "Revert "Remove unused class_alias deprecated in MW 1.40""" 2023-10-03 17:03:31 +00:00
Timo Tijhof
8f778a8b23 ResourceLoader: Improve and generalize validateScriptFile test coverage
In preparation for the underlying library changing, generalize the
tests for this code so that test changes are kept to a minimum in
the actual commit. Rather than test the upstream directly, move
our custom test cases from JsMinPlusTest to ResourceLoader/ModuleTest.

Fix benchmarkJSMinPlus.php to not emit warnings on PHP 8.2 due to
use of dynamic property creation:

> PHP Deprecated:  Creation of dynamic property JSNode::$readOnly
> is deprecated in /mediawiki/includes/libs/jsminplus.php:1728

Bug: T75714
Change-Id: I0515be8229f51de48c1f0c92f09e2d827e1b1add
2023-10-02 18:46:25 -07:00
Fomafix
19d4adbe1c Remove deprecated class alias GetBlockErrorMessageKey
Deprecated since 033e75cb26 included in MediaWiki 1.40.
Use GetBlockErrorMessageKeyHook instead.

Change-Id: I346c7ec9ed7d57e3d1e1aa9f761d24e87c4ec513
2023-10-02 21:44:19 +00:00
Isabelle Hurbain-Palatin
33908cebed Revert "Revert "Remove unused class_alias deprecated in MW 1.40""
This reverts commit cbde6b69de to re-apply
the initial patch. This should only be merged once
I2acfd0b7a1e48aec107ded3bbe4963e2df24f4d3 is deployed.

Change-Id: If12ab65b1d773946fca6c8601ff51290136549c8
2023-09-29 13:08:50 +02:00
Isabelle Hurbain-Palatin
cbde6b69de Revert "Remove unused class_alias deprecated in MW 1.40"
This reverts commit ec22840c4a.

This patch currently creates issues on beta, which still runs with the
latest vendor version of Parsoid. If, for some reason, Parsoid doesn't
get deployed with this patch, I2acfd0b7a1e48aec107ded3bbe4963e2df24f4d3
doesn't get included, and the REST page handler breaks.

Staggered deploy seems safer in this context, hence the proposal for a
temporary revert, and a merge after the next Parsoid vendor patch is
deployed.

Change-Id: I3f859fa807a04892a67323cd4e98be0d3fbb1676
2023-09-29 11:21:49 +02:00
jenkins-bot
e344c53b2c Merge "Remove unused class_alias deprecated in MW 1.40" 2023-09-28 19:03:09 +00:00
Fomafix
ec22840c4a Remove unused class_alias deprecated in MW 1.40
The Helper classes are deprecated since 1afd52e3e4.

Depends-On: I2acfd0b7a1e48aec107ded3bbe4963e2df24f4d3
Change-Id: Ie9973c6d6474bb7b4720c0641ca7492dc946d923
2023-09-28 18:47:13 +00:00
Fomafix
2c3b5df69b Remove deprecated class Wikimedia\Rdbms\MySQLMasterPos
The class name MySQLMasterPos is deprecated since d11c59538a included
in MediaWiki 1.37.

Bug: T282894
Change-Id: I1dd75261dc031da5aef3873b60cb2d86367b44be
2023-09-26 10:11:35 -04:00
Amir Sarabadani
c00148768c Introduce LoggingSelectQueryBuilder
To replace DatabaseLogEntry::getSelectQueryData()

Many migrations can't happen right now because of use of
ChangeTagsStore::modifyDisplayQuery() but I will fix that soon.

Bug: T344971
Change-Id: Iafb2bb5ea3a0da49da1dafb69b65dea3c15029ed
2023-09-25 15:51:24 +02:00
jenkins-bot
369a629996 Merge "Add new maintenance script cleanupPageLang.php" 2023-09-23 18:11:50 +00:00
Bartosz Dziewoński
35596d980a installer: Add database updater for 2008/2011 redirect schema changes
In 2008, the `redirect` table was added, and in 2011, it gained the
fields `rd_interwiki` and `rd_fragment`. We have never performed
proper maintenance for those changes, instead relying on code in
WikiPage to update it when the page was visited, or on an optional
run of refreshLinks.php.

I would like to remove the code in WikiPage, so we probably need to
perform this maintenance in the database updater. You know, for the
millions of people who have been dutifully upgrading their MediaWiki
installations since 2008, but never visited the pages there.

The script is a trimmed-down version of refreshLinks.php, without all
the weird stuff, and using a better index for the queries.

Bug: T346290
Change-Id: Iea251d2737b2fb472c4efb060ad2b97735b4ac53
2023-09-21 20:28:13 -07:00
James D. Forrester
d1ab762c04 Drop the PersonalUrls hook, deprecated in 1.39
Bug: T319087
Change-Id: I398de94099cf17d071bc539a87a140a76fd301bd
2023-09-21 19:44:12 +01:00
James D. Forrester
c1599c91b3 Namespace Config-related classes under \MediaWiki\Config
Bug: T166010
Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
2023-09-21 05:41:58 +00:00
James D. Forrester
468e69bccc Namespace Sanitizer under \MediaWiki\Parser
Bug: T166010
Change-Id: Id13dcbf7a0372017495958dbc4f601f40c122508
2023-09-21 05:39:23 +00:00
James D. Forrester
3851805f64 Namespace remaining User-related classes under \MediaWiki\User
Bug: T166010
Change-Id: Ibda1e8be0f23c6262a32b607f8260cad36f188fc
2023-09-20 09:12:08 +01:00
daniel
7b8187f257 Introduce ActionFactory::getActionInfo
The new method encapsulates the fact that we currently have to
instantiate action objects to determine which permission the action
requires. This encapsulation reduces coupling in PermissionManager
and allows us to easily change to a better way to create ActionInfo
later.

Eventually, ActionInfo should be constructed based on the action's
object spec. This requires us to include the relevant information in all
specs, in core and extensions.

Change-Id: I707a165c41403ebd4a3edfc66c1595e1bd3a4087
2023-09-20 10:06:02 +10:00
James D. Forrester
1d0b7ae1e2 Namespace User under \MediaWiki\User
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
2023-09-19 19:18:16 +00:00
James D. Forrester
5bc2a04b08 Namespace remaining Title-related classes under \MediaWiki\Title
Bug: T166010
Change-Id: Ia2e5a7367cc8cdbd8a7b845ae2fd5d776ff22891
2023-09-19 05:21:23 +00:00
James D. Forrester
41fb118c5c Namespace TitleParser under \MediaWiki\Title
One of the big ones, so doing this alone.

Bug: T166010
Change-Id: I4848e903b0c0a2f7c58ac19e0baeef0085a36bdc
2023-09-19 05:19:00 +00:00
James D. Forrester
b16be7a36c Namespace TitleFormatter under \MediaWiki\Title
One of the big ones, so doing this alone.

Bug: T166010
Change-Id: Ic2d59eb6764b1a273ed7162ecabf641f638b8f66
2023-09-19 05:17:18 +00:00
James D. Forrester
a8a6cfd966 Namespace NamespaceInfo under \MediaWiki\Title
One of the big ones, so doing this alone.

Bug: T166010
Change-Id: Ibe103cd362535d3cb94cb8931e95fc74099d1497
2023-09-19 05:17:04 +00:00
James D. Forrester
94ece673b2 Namespace TitleValue under \MediaWiki\Title
One of the big ones, so doing this alone.

Bug: T166010
Change-Id: I4c901d5c32696d8334ec30cede7d9b6f3d8d645e
2023-09-18 18:24:39 +01:00
James D. Forrester
459cbb0494 Namespace remaining 'specialpage' files under \MediaWiki\SpecialPage
SpecialPageFactory is already here, but none of the others were yet.

Bug: T166010
Change-Id: I9689bf0a1ab329625e23669b99f019b96295fffd
2023-09-18 18:23:13 +01:00
James D. Forrester
5088626212 Namespace 'special' Pagers under \MediaWiki\Pager
They're under 'specials' because that's where they're mostly used,
but they're just another kind of Pager (shown by their use outwith
the MediaWiki\Specials hierarchy, which is a bad code smell for us
to review later).

Bug: T166010
Change-Id: Iad3f91582b723c1e6679525aa852ffdfd8c6d5ba
2023-09-18 18:23:13 +01:00
James D. Forrester
b6f263b043 Namespace HistoryPager under \MediaWiki\Pager
Although it's in a different path, it's alone and only Action-related
because that's where it's used.

Bug: T166010
Change-Id: I6d4cebfd6ad68e1500c3a3a5450c97bfd3327c2b
2023-09-18 18:23:13 +01:00
James D. Forrester
3aeb9d681c Namespace core Pagers under \MediaWiki\Pager
Bug: T166010
Change-Id: Ibe12d1754709d48f71edd4cde1f13a542344a21e
2023-09-18 12:27:56 +01:00
jenkins-bot
e114026bab Merge "Add UserRegistrationLookup" 2023-09-15 16:59:54 +00:00
Martin Urbanec
85e78d22bd Add UserRegistrationLookup
Why:
Temporary accounts introduced as part of IP Masking are supposed
to expire 1 year after their registration. Accounts can have
multiple registration timestamps when in a wiki-farm setup,
depending on which wiki we consult.

To implement the account expiration logic, we need to know the global
(first) registration timestamp.

Similar to CentralIdLookup, a concept of a registration date
provider is introduced. Unlike IDs, users can have multiple
kinds of registration dates (Wikimedia recognizes local and global,
but third parties can have different needs). For that reason,
any number of registration providers can be registered at any
given time; caller determines which one is requested. The default
is `local`, which is the only provider that is guaranteed to exist.

What:
* Add UserRegistrationLookup
* Add UserRegistrationProviders config variable

Bug: T344694
Change-Id: If9fa12a392064dd504590a861a175e3604a34fab
2023-09-15 11:38:23 +02:00
James D. Forrester
0c0d8777a8 Namespace SpecialW* under \MediaWiki\Specials
This completes the namespacing of core special pages.

Change-Id: I195e7fc34a9413bfea0a33c941f2362cd4a7ff10
2023-09-15 09:01:31 +01:00
James D. Forrester
870f7c3f1a Namespace SpecialVersion under \MediaWiki\Specials
Change-Id: Ibeb181c653dac3796c44b36c8ff9f2ed572d5f42
2023-09-14 19:25:51 +00:00
James D. Forrester
87f2b083af Namespace SpecialU* under \MediaWiki\Specials
Change-Id: I75b04a7a65f8d37da12d2ed3892e065e97c92437
2023-09-14 19:24:08 +00:00
James D. Forrester
cc4570464c Namespace SpecialT* under \MediaWiki\Specials
Change-Id: Iaab14a0ded4950c5a6dafc2f301792b6546fb15f
2023-09-14 19:23:23 +00:00
James D. Forrester
a6f3c28865 Namespace SpecialS* under \MediaWiki\Specials
Change-Id: Icccdaa93f8089d88b6d3ba153ecfaa22c901ce66
2023-09-14 19:23:14 +00:00
James D. Forrester
ea2979b8ca Namespace SpecialR* under \MediaWiki\Specials
Change-Id: I735222c437313db139cd9fc780c332767189323f
2023-09-14 14:35:03 +01:00
jenkins-bot
99b0d1493d Merge "rdbms: Rename DatabaseMysqlBase to DatabaseMySQL" 2023-09-13 19:29:12 +00:00
James D. Forrester
f17ccb46ae Namespace SpecialP* under \MediaWiki\Specials
Change-Id: I10211c4406b1eedd6e5de63f1e57868f924640db
2023-09-13 14:41:15 +00:00
James D. Forrester
158e6ab5f2 Namespace SpecialN* under \MediaWiki\Specials
Change-Id: I403664ce3585f022e89da75e75baefa4b4db29f9
2023-09-13 12:30:32 +01:00