Commit graph

1375 commits

Author SHA1 Message Date
Timo Tijhof
051e127bdb language: Move l10n-related classes from /cache to /language
* Make the code easier to own and maintain by being part of a topical
  area of expertise rather than a generic catch-all bucket.
  This also helps Gerrit team dashboards, [[mw:Git/Reviewers]]
  subscription patterns, more meaningful component prefix for
  [[mw:Commit_message_guidelines]].

* Prep for possible CODEOWNERS adoption.

* Prep for T166010 to give us better PSR-4 namespaces that we won't
  have to break/migrate again shortly after for the above.

Bug: T225756
Change-Id: I62c701d574d2a79365b1c5350f92bef47770e3ce
2022-06-28 16:27:20 -07:00
Moh'd Khier Abualruz
a7831e4e37 Remove poweredbyico SkinTemplate variable AND SkinGetPoweredBy hook
- poweredbyico removed
- copyrightico removed
- SkinGetPoweredBy, SkinGetPoweredByHook removed
- Release Notes updated

Bug: T306138
Change-Id: I6171b487e1ab0235b81a8a21a1decaf5cfdc4c1c
2022-06-28 22:39:33 +00:00
Aaron Schulz
da9e4b52a5 rdbms: Add multi-statement query support to Database
Add Database::queryMulti(), which will execute an array of
queries as a batch with minimal roundtrips.

SQLite fallbacks to looping through each statement and
invoking doQuery().

Add QueryStatus class to reduce complexity in Database.

Rewrite doQuery() as doSingleStatementQuery().

Change-Id: I3d51083e36ab06fcc1d94558e51b38e106f71bb9
2022-06-09 11:45:38 +10:00
Derick Alangi
2a83d6bf84 maintenance: Display the birth date & age of a wiki install
This maint script computes and displays a wiki's birth date and
birthday in yy, mm, dd format.

Sometimes, one would like to know when a wiki was installed and
potentially the age of the wiki.

Change-Id: If42c74a04491d4331dcd7f6fc00c9460d6e1d51f
2022-06-07 11:50:24 +01:00
jenkins-bot
cf7f61fcf9 Merge "Settings: Generate schema artefacts using a single maintenance script" 2022-06-05 19:34:45 +00:00
daniel
ad11b034ab Settings: Generate schema artefacts using a single maintenance script
Previously, each of the four derived config schema files had to be
regenerated using a separate maintenance script. This change simplifies
regeneration by combining all for scripts into a single command that can
be used to regenerate all relevant files after changing
MainConfigSchema.

Change-Id: I7d38d8a4aede60475c4bdd0053d2e10e298b9843
2022-06-05 19:17:29 +00:00
Umherirrender
0441ea0371 specialpage: Remove deprecated class alias SpecialPageFactory
Deprecated since 1.35

Change-Id: I71682316a4aa7b7b1c9dc5af37b2b1a09126b57a
2022-06-03 14:07:22 +02:00
jenkins-bot
29878a3f71 Merge "api: Remove deprecated class alias ApiQueryContributions" 2022-05-29 07:10:16 +00:00
jenkins-bot
778494c6bf Merge "Remove deprecated MediaWiki\Storage namespace for revision related class" 2022-05-29 07:09:17 +00:00
jenkins-bot
3dba007822 Merge "content: Remove UnknownContent/UnknownContentHandler class alias" 2022-05-29 07:07:42 +00:00
Umherirrender
f07295ade1 content: Remove UnknownContent/UnknownContentHandler class alias
Renamed in a67cad6 in 1.36
The fallback content is designed for internal use only

Change-Id: I6977a9cf1eab0e701fd6969b1a2b5d1dfcecfdfa
2022-05-29 06:20:45 +00:00
Umherirrender
a2a1a4ecd2 Remove deprecated MediaWiki\Storage namespace for revision related class
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: I48cdc65301a8cd20d2bedd031dbdae33b8c2a34d
2022-05-29 06:17:01 +00:00
Umherirrender
2f7c0d6166 api: Remove deprecated class alias ApiQueryContributions
Deprecated since 1.32

Change-Id: Ia4d2d01272175972f29a724c06c249bfeb522cfe
2022-05-29 06:15:38 +00:00
Umherirrender
71974b4a3e language: Remove deprecated FakeConverter class alias
Deprecated since 1.35

Change-Id: If3f1eb881db9ebd89b39545285f0540e76ef62b6
2022-05-28 16:05:41 +02:00
jenkins-bot
efa485a54d Merge "Extract parameter handling from Maintenance base class." 2022-05-26 17:53:53 +00:00
daniel
a9f47fd5ad Extract parameter handling from Maintenance base class.
We will need parameter handling in the runner as well as in the actual
maintenance script. So pull it out, so we can re-use it.

Change-Id: Ib67667fead8350e0a539323fb05b160f4c2d882e
2022-05-25 10:40:24 +02:00
Tim Starling
3e2653f83b ResourceLoader namespace (attempt 2)
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader itself.

Move the tests by analogy.

I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".

I did not address DependencyStore which continues to have a non-standard
location and namespace.

Revert of a241d83e0a.

Bug: T308718
Change-Id: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
2022-05-24 15:41:46 +00:00
Amir Sarabadani
24115a8f4c Start clean up of revision_actor_temp table
It is being dropped in production

Bug: T215466
Change-Id: I66b2cb8653252e720c897351065978119f040ba7
2022-05-23 15:37:42 +00:00
daniel
824ddac27b Move code from doMaintenance.php into a runner class.
This is the first step toweards having a proper script runner.

Change-Id: I121ef0186b7112f12d30229293baf89c93c971b4
2022-05-21 16:09:57 +02:00
daniel
237bbf089f Turn DefaultSettings.php into a deprecated stub
DefaultSettings.php has been replaced by MainConfigSchema.
Loading DefaultSettings.php is deprecated.

Code that needs to have access to configuration defaults should use the
ConfigSchema service object.

Bug: T300129
Change-Id: I7b2c0ca95a78990be1cdb9dd9ace92f6dcf1af15
2022-05-17 16:50:56 +02:00
Lucas Werkmeister (WMDE)
a241d83e0a Revert "ResourceLoader namespace"
This reverts commit e08ea8ccb9.

Reason for revert: Breaks Phan in extensions, and as far as I’m aware,
this change isn’t urgently needed for anything, so the simplest fix is
to revert it again for now. After PHP 7.4 it should be safer to try this
again (we hopefully won’t need the two “hack” classes by then).

Bug: T308443
Change-Id: Iff3318cbf97a67f821f78e60da62a583f63e389e
2022-05-16 14:43:33 +00:00
Tim Starling
e08ea8ccb9 ResourceLoader namespace
Move ResourceLoader classes to their own namespace. Strip the
"ResourceLoader" prefix from all except ResourceLoader and
ResourceLoaderContext.

Move the tests by analogy.

I used a namespace alias "RL" in some callers since RL\Module is less
ambiguous at the call site than just "Module".

I did not address DependencyStore which continues to have a non-standard
location and namespace.

Change-Id: I92998ae6a82e0b935c13e02a183e7c324fa410a3
2022-05-16 14:41:27 +10:00
Alexander Vorwerk
ea1c106ea9 Remove the deprecated MWNamespace class
Bug: T291389
Change-Id: I98ec284bdf8599ee2edfad55096dc42ba3ed23d4
2022-05-14 11:38:43 +00:00
Clare Ming
ae6d0f33af Introduce interface ComponentRegistryContext
- To mitigate passing around Skin god object.
- Provide limited context for components.
- Update relevant classes.

Bug: T301722
Change-Id: Icb7ea7ae5b86a39adf6eb2805b2bf42fb71d3bd0
2022-05-09 20:36:36 +00:00
Amir Sarabadani
ca5b162c23 rdbms: Start using SQLPlatform and move more methods there
The first of many changes decoupling SQL building blocks from Database
class.

Bug: T299691
Depends-On: I5d1d5b9b875bced7bda234f45d6d22ed59db4871
Change-Id: I784e78361f5ee629d31c68629d669ee0ddddf929
2022-05-04 18:34:13 +00:00
Tim Starling
05701ffc40 rdbms: Remove instance ownership concept
Instance ownership is supposed to protect LoadBalancer and Database
against unauthorized calls to internal methods other than by the owning
LoadBalancer/LBFactory. This seems like unnecessary complexity. It was
introduced for T231443 and T217819, but the link was speculative and in
the end it didn't help to fix or isolate those bugs. Since then it has
caused a production error (T303885) and an intermittent CI failure
(T292239).

Instead, split the ILoadBalancer interface, introducing
ILoadBalancerForOwner, which contains the methods which are only safe
to call by LBFactory or by the caller of LBFactory::newMainLB(). This
allows phan to statically detect inappropriate calls to internal
methods.

Ownership was used for convenience for two things unrelated to its
original purpose:

* Suppressing calls to ScopedCallback::newScopedIgnoreUserAbort() when
  the caller has already called it. But nested calls are apparently
  harmless, so I just called it unconditionally.
* Suppressing exceptions from Database::close(). I extended the
  behaviour for owned instances to apply to all instances, so even
  unowned instances will no longer throw on close.

CodeSearch suggests nothing in extensions is calling these methods with
an owner parameter. One extension (Wikibase) overrides a method with an
owner parameter in a test mock class and so needs to be simultaneously
updated.

Depends-On: Ib03aba9d8f5f05b875a321d00b14483633a636a8
Change-Id: I27ba4973d24d759c88b3868c95e7db875801ca0c
2022-04-26 11:48:46 +10: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
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
jenkins-bot
2a92b07ad3 Merge "Create ParserFetchTemplateData hook" 2022-04-07 06:00:40 +00:00
jenkins-bot
a45305e498 Merge "file: Move json metadata storage out of LocalFile" 2022-04-07 01:28:25 +00:00
Amir Sarabadani
5da58d6028 file: Move json metadata storage out of LocalFile
So ArchivedFile could use it as well

Bug: T298417
Bug: T298398
Change-Id: Idd258437d9f91824195ed0c12b5694841cb365b0
2022-04-07 01:11:46 +00:00
jenkins-bot
75435bce48 Merge "maintenance: Move MWTerm classes to /tests/parser/" 2022-04-05 17:10:39 +00:00
jenkins-bot
6da4f4b9a8 Merge "Create ParserLogLinterData hook" 2022-04-05 05:39:53 +00:00
jenkins-bot
18782a3dc9 Merge "Benchmark script for settings loading." 2022-04-04 00:05:38 +00:00
daniel
14978e264c Benchmark script for settings loading.
Change-Id: I323a3469c574b55ad78abb35863f30b1007f3135
2022-03-31 16:36:34 +02:00
jdlrobson
0acc0b5151 Introduce SkinComponentSearch
Changes:
* Internal SkinTemplate::getSearchInputAttributes method is removed
* Skin::makeSearchInput and Skin::makeSearchButton are hard deprecated.
Methods moved to SkinTemplate to support skins using BaseTemplate
(this avoids deprecation warnings in Timeless)
* Correct the function signature for Skin::getRelevantTitle and the
caller in Linker to take into account the use of getTitle and the
possibility of a null return.

Bug: T301723
Change-Id: I0906cd1582b93c741b93503562ec0fe37d80d948
2022-03-31 06:54:42 +00:00
Aaron Schulz
10a27c76f5 rdbms: track active transaction IDs for named locks and temp tables
Add TransactionIdentifier class, similar to AtomicSectionIdentifier,
that represents applications-side tokens for transactions. Move the
string ID logic there.

The transaction tokens can be used to determine whether rollback()
alone is sufficient to recover from a connection loss. This will
be done in a follow up patch.

Change-Id: I9c68b0c5a23800001fca49cabd6cc38fce4d5c00
2022-03-29 19:35:38 +00:00
jenkins-bot
f05e371bbd Merge "Copy over Parsoid's Config and ServiceWiring classes" 2022-03-29 18:29:16 +00:00
C. Scott Ananian
1c3216bf92 Create ParserFetchTemplateData hook
This is moved from TemplateData, but the interface isn't quite right.
Filed T304899 to improve it in the future.

Bug: T304740
Change-Id: Iadd1ed70b72fc282bd5addfc1654aa73322ea470
2022-03-28 17:25:34 -04:00
C. Scott Ananian
3cd693aed6 Create ParserLogLinterData hook
This hook was formerly defined by Extension:Linter and invoked by
Parsoid, but as this part of Parsoid is moving into core the hook
should now be defined by core as well.

Bug: T304740
Change-Id: Iffd073e510202e5766632cc01d3585815289b7b4
2022-03-28 17:25:34 -04:00
C. Scott Ananian
2d66ee70a2 Copy over Parsoid's Config and ServiceWiring classes
* This is the first step of migrating Parsoid integration code into
  core and transitioning Parsoid from an extension to a pure library.

* Parsoid already has conditional code to skip loading Parsoid's
  copy of its classes, but it relies on the existence of ParsoidServices.
  Technically ParsoidServices isn't needed once Parsoid is migrated to
  core -- users can just use MediaWikiServices instead -- but we need
  to temporarily add ParsoidServices as a marker class during the
  transition.

This version of Parsoid's ServiceWiring comes from Parsoid commit
898c813fd832b3f2d7b5a37f60bd65e8368ce18f.

Bug: T302118
Change-Id: I0b388d93143a782c2c3b72e46407572e5c586e4a
2022-03-28 12:36:38 -04:00
Alexander Vorwerk
38d71c95ad Remove DBMasterPos as an alias for DBPrimaryPos
Bug: T282894
Change-Id: I1f214653d431a2393f40bf963fd422de06fa4363
2022-03-27 21:15:19 +02:00
jenkins-bot
2df0aa9200 Merge "Remove deprecated EventRelayerKafka and KafkaHandler" 2022-03-25 15:16:33 +00:00
Amir Sarabadani
603569ab22 maintenance: Add migrateLinksTable.php
To populate tl_target_id and other tables in the future.

Bug: T299423
Change-Id: I067e861f95555bf7630f32a26c8f6a2284367897
2022-03-25 02:21:34 +01:00
Timo Tijhof
2de79774e1 Remove deprecated EventRelayerKafka and KafkaHandler
Also remove the unmaintained kafka-php package from the from "suggested"
and "dev" composer dependencies, as this is now no longer used.

Change-Id: If5668974f417b627df95bce47db18d46fa03327c
2022-03-25 00:07:22 +00:00
Timo Tijhof
f745292c69 maintenance: Move MWTerm classes to /tests/parser/
This further removes files that are not maintenance scripts from this
directory. It isn't used outside of tests, either.

While at it, rename this to a PSR-4 namespace consistent with some of
the other test-only classes.

Change-Id: Ibc49617631f17a5e9489789a90a7b8537340ead3
2022-03-24 21:01:14 +00:00
jenkins-bot
7894e49ea8 Merge "Generate config name constants." 2022-03-18 11:09:44 +00:00
jenkins-bot
18875c2c0f Merge "Generate DefaultSettings.php from schema" 2022-03-18 11:02:51 +00:00
daniel
6880561a4d Generate config name constants.
We can generate a class that contains constants for all config variable
names. This removes the need to rely on string literals when calling
Config::get, and it provides a place for documentation that integrates
better with IDEs than the markdown file.

Change-Id: I817dc14c4ce8fc0a29d9c07e8fd393c4f359cade
2022-03-18 10:32:58 +01:00
daniel
1ee8fde16b Generate DefaultSettings.php from schema
Avoid having to maintain defaults twice.

Change-Id: I7a883fe3c952cc653d43b7e399631ec3beab0bc3
2022-03-18 10:25:52 +01:00