Commit graph

12433 commits

Author SHA1 Message Date
jenkins-bot
cc1b0fff9f Merge "GlobalIdGeneratorTest is not a unit test" 2022-04-24 17:19:29 +00:00
jenkins-bot
9506ff4079 Merge "rdmbs: Start of SQLPlatform to split out of Database" 2022-04-24 16:26:52 +00:00
Amir Sarabadani
236a0941c0 rdmbs: Start of SQLPlatform to split out of Database
This is the first step to split parts of Database that doesn't require a
connection and are used for query parts.

Bug: T299691
Change-Id: I140aa4328865994499926f898233867ce383908c
2022-04-24 16:07:44 +00:00
Aryeh Gregor
e0e3e81c87 Finish testing dynamic config
Bug: T305093
Change-Id: Iebd58d91a3bba08a59792dcf569e80f2a20322e9
2022-04-24 16:46:55 +03:00
jenkins-bot
b28e675359 Merge "More dynamic config tests" 2022-04-24 13:11:25 +00:00
Aryeh Gregor
62e5146a13 GlobalIdGeneratorTest is not a unit test
It calls the Shell class, which uses MediaWikiServices. Why was this not
causing test failures on CI?

Change-Id: Id953c1425659ede158034988dd652b59a0e9811b
2022-04-24 15:49:43 +03:00
Aryeh Gregor
d16c7f3c90 More dynamic config tests
Change-Id: I2158cfd9d3cddf25dc99cc53c82d83e47c0c0e6b
2022-04-24 15:43:15 +03:00
jenkins-bot
ac75525f51 Merge "Use more specific assertions in HTMLTitleTextField test" 2022-04-23 22:26:30 +00:00
jenkins-bot
e1e2455dee Merge "objectcache: remove "multiPrimaryMode" DB type assertion" 2022-04-23 20:32:31 +00:00
Thiemo Kreuz
312566d156 Use more specific assertions in HTMLTitleTextField test
I would like to argue that it's useful to know if an error message is
returned, and if it's the correct one.

Bug: T306568
Change-Id: I865fa4c8a5b2d2d88d26c190352c852e63913a56
2022-04-23 22:10:26 +02:00
Daimona Eaytoy
a159a3ed15 phpunit: Remove some unnecessary code from phpunit.php
Also add a method for setting changes that should be reapplied after
loading the setting files, and set $wgShowHostnames in TestSetup, since
it seems like it may be useful when running all kind of tests.

Bug: T90875
Change-Id: I0d54c9a23f6cebf91bbb5a3a5f03b3d650e386e9
2022-04-23 16:29:42 +00:00
Aaron Schulz
cc1bb73490 objectcache: remove "multiPrimaryMode" DB type assertion
Since no mysql-specific queries are required, allow sqlite and
Postgres setups to use "multiPrimaryMode" for easier testing.

Avoid "CASE types text and integer cannot be matched" Postgres
error by making dbEncodeSerialValue() cast the result to a string
so that addQuotes() applies in buildUpsertSetForOverwrite().

Bug: T212129
Change-Id: Ic84a804c272a7070779c8d41d3a33003852d0839
2022-04-21 16:20:39 -07:00
Daimona Eaytoy
da39a91e2d Remove fallback to MediaWikiServices in MovePage::__construct
Also reorder class members so that all dependencies are grouped
together.

Change-Id: Id1c91afd7f9051ea72ba8bea3b5eca7c791e7fb0
2022-04-20 21:06:44 +00:00
Reedy
5f2584b648 tests: Rename fixtures/bad.json
Bug: T306524
Change-Id: I3b97c041bf2e1171bd6e31774de12ae1d73f95a4
2022-04-20 15:17:36 +01:00
jenkins-bot
296165451a Merge "UndeletePage: Improve reason when restoring assoc talk page" 2022-04-15 19:07:05 +00:00
Dayllan Maza
88da2fb706 UndeletePage: Improve reason when restoring assoc talk page
When restoring a talk page via undeletion of the associated
page, the recorded reason should specified that it was restored
via that method

Follow-Up: I7b30863060974d4079639
Bug: T305523
Change-Id: I18ec58e6df00b038542868ce5de6c23fd700d749
2022-04-14 21:49:23 -04:00
Umherirrender
f4ecf27283 PermissionManager: Remove usage of protection related Title function
Bug: T306131
Change-Id: I43bea6d80c5670ef1ccb812e4158b49426947153
2022-04-14 22:10:24 +00:00
jenkins-bot
5606669e6f Merge "Remove usage of protection related deprecated Title function" 2022-04-14 22:08:40 +00:00
Umherirrender
e3a741661a Remove usage of protection related deprecated Title function
Bug: T306131
Change-Id: I487a12a88ae82c367d1cbb2e52083fe20b27d4ce
2022-04-14 21:42:55 +00:00
Umherirrender
2909d06a08 Use new namespace for revision related classes
All revision related classes are namespaced MediaWiki\Revision
instead of MediaWiki\Storage since 1.32. The old namespaced
class names are deprecated and only kept for backwards-compatibility.

Bug: T305784
Change-Id: I34e492d84d9fc4bc78481667202716d93b3c43cb
2022-04-14 23:03:43 +02:00
jenkins-bot
99836b7c2a Merge "Drop $wgMultiContentRevisionSchemaMigrationStage config" 2022-04-14 19:13:37 +00:00
jenkins-bot
559af34cc9 Merge "Promote experimental revision rest endpoints to official" 2022-04-14 19:13:14 +00:00
jenkins-bot
bd8691818a Merge "TempUser infrastructure and services" 2022-04-14 15:33:50 +00:00
jenkins-bot
d2e7be31d8 Merge "rdbms: make automatic connection recovery more robust" 2022-04-14 01:33:46 +00:00
Aaron Schulz
db36853718 rdbms: make automatic connection recovery more robust
Rename canRecoverFromDisconnect() in order to better describe
its function. Make it use the transaction ID and query walltime
as arguments and return an ERR_* class constant instead of a bool.
Avoid retries of slow queries that yield lost connection errors.

Track session state errors caused by the loss of named locks or
temp tables (e.g. during connection loss). Such errors will prevent
further queries except for rollback() and flushSession(), which must
be issued to resolve the error.

Add flushPrimarySessions() methods to LBFactory/LoadBalancer
and use it in places where session state loss is meant to be
safely aknowledged.

Change-Id: I60532f86e629c83b357d4832d1963eca17752944
2022-04-14 11:09:31 +10:00
Amir Sarabadani
280c2ed0d3 rdbms: Fold MaintainableDBConnRef into DBConnRef
We really don't need this complexity and it prevents us from improving
connection management.

MaintainableDatabase should stay but the connection ref shouldn't.

Bug: T255493
Change-Id: I867301dc7fa07cac298f8faba9cf82ca4617f50e
2022-04-14 01:57:11 +02:00
Tim Starling
e8dbf5f80c TempUser infrastructure and services
Add services and utilities for automatic creation of temporary user
accounts on page save, in order to avoid exposing the user's IP
address.

* Add $wgAutoCreateTempUser, for configuring the system
* Add TempUserConfig service, which interprets the config.
* Add TempUserCreator service, which creates users during page save as
  requested by EditPage. With proxy methods to TempUserConfig for
  convenience.
* Add table user_autocreate_serial. Table creation is necessary before
  the feature is enabled but is not necessary before deployment of this
  commit.

Bug: T300263
Change-Id: Ib14a352490fc42039106523118e8d021844e3dfb
2022-04-14 09:23:55 +10:00
jenkins-bot
f9e634ece8 Merge "pager: Improve Y2K38 check to keep leading zero in 3-digit years" 2022-04-13 22:38:59 +00:00
jenkins-bot
53937fa9da Merge "Drop messagebox, warningbox, errorbox classes" 2022-04-13 19:52:12 +00:00
jenkins-bot
e5077e2059 Merge "Fix SignatureValidatorFactory circular dependency" 2022-04-13 18:52:22 +00:00
Umherirrender
65bceb8a0e pager: Improve Y2K38 check to keep leading zero in 3-digit years
(int) removes the leading zero from '0720-01-05',
just check it as string.

Add test for the Y2K38 check

Bug: T287621
Change-Id: I83400066ee4ab58c1c27ca1041c495dc0e16531f
2022-04-13 19:52:19 +02:00
jenkins-bot
ee93852f42 Merge "Fix WikiFarmSettingsLoaderTest failure if MW_WIKI_NAME is defined" 2022-04-13 17:25:18 +00:00
Bill Pirkle
fc7acbee64 Promote experimental revision rest endpoints to official
These three endpoints have been experimental for many months:
  revision/{id}
  revision/{id}/html
  revision/{id}/with_html
Promote them to officially released. This completes the
basic "revision" endpoint support, and helps clear out
the coreDevelopmentRoutes.json file for unrelated
experiments.

This also modifies the existing revision/{id}/bare endpoint
response, which previously pointed callers to the experimental
endpoint for html. It now points callers to the official one.

Bug: T305506
Change-Id: Iee8d1723e98dd3e3e389a0514dde28799914b2fd
2022-04-13 11:30:53 -05:00
jenkins-bot
480a382266 Merge "Add more support for read new in links migration" 2022-04-13 09:21:42 +00:00
Tim Starling
13c1839735 Fix SignatureValidatorFactory circular dependency
Parser is using the service container to get a SignatureValidator
because, as noted in Gerrit comments on the relevant commit, there is a
circular dependency Parser -> SignatureValidatorFactory -> Parser.

So, have SignatureValidatorFactory::__construct() take a closure which
returns a Parser, instead of an actual Parser or ParserFactory.

Change-Id: I7bf4660f84ec8c8fb1d5b3b8581fe5d82bc3156e
2022-04-13 12:38:00 +10:00
Umherirrender
d7809a41d9 logging: Normalize "infinity" in BlockLogFormatter for pre-T241709 rows
This allows the API to consistently return the new value for old rows.

Bug: T241709
Follow-Up: I36f49dc83718cc78f17fc340e6445030b8fd0c66
Change-Id: Ida69980f62a6ef070ba41b7e826967f424881716
2022-04-12 20:57:18 +00:00
Alexander Vorwerk
0779a61e15 Drop $wgMultiContentRevisionSchemaMigrationStage config
has no effect since 1.35

Bug: T231674
Change-Id: I69a4463cce42cbd79e1137d748e4a70781999cfb
2022-04-12 21:29:41 +02:00
Alexander Vorwerk
3dd77b0c47 BotPasswordSessionProvider: inject GrantsInfo
MWGrants is deprecated and should be replaced with the GrantsInfo and
the GrantsLocalization services.

Bug: T253077
Change-Id: I3cbf568b6de654acb6b06b4ab5d9d97a09f78ece
2022-04-12 18:48:48 +02:00
jenkins-bot
eaca8204ad Merge "Refactor URL-parsing global functions to class" 2022-04-12 14:49:46 +00:00
jenkins-bot
0a0e6e2d19 Merge "Test dynamic configuration logic" 2022-04-12 13:17:07 +00:00
Aryeh Gregor
7fe63e48c5 Test dynamic configuration logic
To do so, we move the relevant parts to a separate include file that's
included both by Setup and the test.

The --color-moved option is highly recommended when reviewing this patch
to verify correctness.

More tests to come.

Bug: T305093
Change-Id: I931b92357ec48db4665891c8546f86264885e881
2022-04-12 15:21:35 +03:00
Aryeh Gregor
472a914c63 Refactor URL-parsing global functions to class
The new class, UrlUtils, is usable standalone or as a service. Using it
as a service will just automatically load a few settings from site
configuration.

In addition to just making our code cleaner, this will enable making
some of Setup.php's dynamic configuration more sane.

Test coverage is all lines except invalid URLs -- I couldn't find any.

Bug: T305093
Change-Id: I706ef8a50aafb518e13222719575d274c3583b90
2022-04-12 15:14:35 +03:00
Amir Sarabadani
19e77d4fc9 Add more support for read new in links migration
- In Info action and its API counter part
 - In LinkBatch::constructSet
 - In Title::getLinksFrom

Bug: T304780
Change-Id: I449f041986acdd16feecac818e3579987b4b11be
2022-04-12 02:22:17 +02:00
jenkins-bot
800f261e8e Merge "phpunit: Support setting skin context in BundleSizeTest subclasses" 2022-04-12 00:08:35 +00:00
lens0021
7798f184e8 phpunit: Support setting skin context in BundleSizeTest subclasses
BundleSizeTest is mainly used by skins to test the size of the modules
of the skin. Using default skin may cause unexpected results.

Bug: T305779
Change-Id: Id77c6124c9b1fd20633cda47bbca89f9b6724a63
2022-04-11 23:50:45 +00:00
Umherirrender
2582db5ed2 DeprecationHelper: Fix method name in deprecation message
The wfDeprecated is called directly from __get/__set/__isset which needs
only a 2, not 3. That means the message is one caller of.

Change-Id: Ia29fb0a07841f69a4d8b95431f0915df9793c340
2022-04-11 23:30:06 +00:00
jenkins-bot
b4a0598553 Merge "HistoryPager: Refactor to avoid special handling for the last row" 2022-04-11 20:04:58 +00:00
Jon Robson
1c13772366 Drop messagebox, warningbox, errorbox classes
This can be done when relevant communities have been notified
and the classes have rolled out of cached HTML.

Bug: T270796
Change-Id: If35ebe88702bf97f2306c77b26d8b3cab4c0420d
2022-04-11 17:40:04 +00:00
Bartosz Dziewoński
2ec4f9d466 HistoryPager: Refactor to avoid special handling for the last row
Displaying each row requires the revision ID from the next row, to
create the 'undo' and 'prev' links. (These links specifically refer to
the next displayed row, according to the current filters, and not just
the previous revision, like the byte diff numbers.)

Previously this class would override normal row formatting to display
the previous row instead when the normal pager would display the
current row, and then handled the last row specially. This code dates
back to 2006: 20949b0961. It was complicated, and got more complicated
when grouping by dates was introduced (ed63ede657), when it caused the
last row to be displayed in a separate list.

Thanks to the addition of batch processing in f7f84dddb3, we don't
need to do that any more: the necessary information about revisions is
pre-computed and we can just look up the ID for next row while
displaying the previous one.

Bug: T303210
Change-Id: I838b0bd4c04faf4f83b21282deb757207ab1732a
2022-04-11 18:31:12 +02:00
Aryeh Gregor
1560b98225 Type hints for ArrayAccess and JsonSerializable
These two interfaces' methods have tentative return types in PHP 8.1,
which causes code without the type hints to raise warnings. Where the
type hint is "mixed", we need to use the special declaration
[\ReturnTypeWillChange] in a comment to suppress the warning as long as
we still support PHP < 8.0, which doesn't have a "mixed" type hint.

Bug: T289879
Change-Id: I1a126e602e92b8d13c7795eb6d790effd5ddc986
2022-04-11 15:06:27 +03:00