Commit graph

10988 commits

Author SHA1 Message Date
jenkins-bot
9f0144af08 Merge "Use StatusValue::getMessages() instead of deprecated methods" 2024-05-29 02:12:05 +00:00
jenkins-bot
ed10e9dbfb Merge "Remove TemplateLinksSchemaMigrationStage config" 2024-05-28 11:45:51 +00:00
Umherirrender
57d623f530 Change some type hints from IDatabase to IReadableDatabase
Use narrow interface if no writes are done

Change-Id: I55148c8b6fda8830a29a235c63fc118f636ab3e6
2024-05-24 16:11:12 +00:00
C. Scott Ananian
a565e388f9 Move ParsoidOutputAccess::supportsContentModel() into Parsoid SiteConfig
The `supportsContentModel` method is really querying Parsoid for the
set of content models it supports, so it makes sense to put it in the
Parsoid-specific SiteConfig service.

This is part of the work to deprecate and remove ParsoidOutputAccess.

Change-Id: I81eb2df8cef93ede95361a4e03185b3d58e5b84b
2024-05-22 10:57:37 -04:00
jenkins-bot
7e0b410a8f Merge "maintenance: getLagTimes migrate to StatsFactory" 2024-05-22 11:59:32 +00:00
jenkins-bot
e23d013ff8 Merge "Replace IDatabase::buildLike with expression builder" 2024-05-21 21:51:18 +00:00
Ebrahim Byagowi
848a9f279f Add namespace and deprecation alias to JsonContent
This patch introduces a namespace declaration for the
MediaWiki\Content to JsonContent and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I44abb1ab5bd1fabf9886dc1457e241d7cae068bc
2024-05-20 18:57:07 +03:30
jenkins-bot
5a74e8a7b6 Merge "Add namespace and deprecation alias to TextContent" 2024-05-20 00:47:30 +00:00
Ebrahim Byagowi
97d1202784 Add namespace and deprecation alias to TextContent
This patch introduces a namespace declaration for the
MediaWiki\Content to TextContent and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Ic251b1ddfcf6db9c85cb54cddf912aa827d2bc3a
2024-05-19 23:23:01 +03:30
Ebrahim Byagowi
d21cc67450 Add namespace and deprecation alias to FileBackend
This patch introduces a namespace declaration for the
Wikimedia\FileBackend to FileBackend and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: Id897687b1d679fd7d179e3a32e617aae10ebff33
2024-05-19 22:35:58 +03:30
Reedy
5ab70409f5 Namespace includes/password
Bug: T353458
Change-Id: I1a701b5b7ff65356692abb0efde9a2207b6135b6
2024-05-18 16:17:38 +01:00
Bartosz Dziewoński
cfcfe299e2 Use StatusValue::getMessages() instead of deprecated methods
This commit replaces some of the uses of getErrorsArray(),
getWarningsArray(), getErrorsByType(), and getErrors().
In many cases the code becomes shorter and clearer.
Follow-up to Ibc4ce11594cf36ce7b2495d2636ee080d3443b04.

Change-Id: Id0ebeac26ae62231edb48458dbd2e13ddcbd0a9e
2024-05-18 14:45:54 +00:00
Umherirrender
be157850ad Replace IDatabase::buildLike with expression builder
Bug: T361023
Change-Id: I0fcb61ff1b15931477bce3c8f850a8ce97405a36
2024-05-18 12:29:17 +00:00
Reedy
2a26f0ecf1 cleanupSpam: Add import for Database
Change-Id: Ia13c319cef766dd345b828c5f0bc8e40ede06863
2024-05-17 13:30:53 +01:00
Ebrahim Byagowi
a717db8e60 Add namespace and deprecation alias to FormatJson
This patch introduces a namespace declaration for the
MediaWiki\Json to FormatJson and establishes a class
alias marked as deprecated since version 1.43.

Bug: T353458
Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
2024-05-16 16:28:01 +03:30
Ebrahim Byagowi
14b4269d83 Add namespace and deprecation alias to Xml and XmlSelect
This patch introduces a new namespace declaration,
MediaWiki\Xml and adds Xml and XmlSelect to it
and establishes class aliases marked as deprecated
since version 1.43.

Bug: T353458
Change-Id: I45cccd540b6e15f267d3ab588a064fbeb719d921
2024-05-16 15:23:14 +03:30
Umherirrender
420e071271 Remove TemplateLinksSchemaMigrationStage config
Bug: T299417
Follow-Up: I906e069a63d1dae14924c72318b22b16244371d6
Change-Id: Ia5f730af82f904bd42552e6c6a5c4dadf2454d3a
2024-05-15 22:27:44 +02:00
Cole White
06e6bdaf68 maintenance: getLagTimes migrate to StatsFactory
Creates two metrics, one emitting milliseconds for
backwards-compatibility and another emitting seconds, aligned with
Prometheus' upstream recommendations.

Update test.

Bug: T359382
Change-Id: Id5a22937b60a209b6ba46633879551d24cf93a45
2024-05-15 17:04:14 +00:00
Reedy
75dc9d8415 wrapOldPasswords: Improve progress output and decrease batch size
Similar as done to CA script, incoporating:

* a09e50656c22f486a2169318d3bc020592c47ffe
* da2d6db2c028b94c3eb63331c9035dbf22140c9e
* 087fca71e3d05d891d74ba36738b3347f45b95f5
* 224fcb473a9326e524b3f7dc0eae36cd4db61501
* 1be0586281881c8c9e485501fe5c28ab060bcc3f

Change-Id: I80a7046a4a0c6a699645aced225362baeb6cd732
2024-05-15 11:51:47 +00:00
jenkins-bot
283667d68f Merge "foreign-resources: Add CycloneDX export support" 2024-05-13 17:09:55 +00:00
Tim Starling
a5372218b7 block: Deprecate and stop using $wgBlockTargetMigrationStage
* Deprecate and stop using $wgBlockTargetMigrationStage. Remove
  block_target migration code.
* Make the $schema parameters to DatabaseBlockStore methods default to
  SCHEMA_BLOCK. Avoid passing these parameters where possible.
* Remove cleanupBlocks.php
* Deprecate DatabaseBlock static methods which try to present the old
  schema for b/c.

Bug: T362133
Change-Id: I845bad8cc09a4528fef46a6f9d490ebdec881d99
2024-05-10 15:54:17 +10:00
jenkins-bot
205892a73b Merge "block: Migrate to the new block schema on non-WMF wikis" 2024-05-10 01:48:46 +00:00
Amir Sarabadani
906b7757b6 Disable namespaceDupes again
Bug: T364546
Change-Id: I09bc73f30ca4d7bb3855a2f0b8c1dcf00e102bf5
2024-05-09 16:21:53 +02:00
Tim Starling
2998d9bd47 block: Migrate to the new block schema on non-WMF wikis
Migrate from ipblocks to block/block_target and drop the ipblocks
table. Update tests.

In PostgresUpdater, change some schema update functions to skip field
updates if the table doesn't exist, by analogy with
DatabaseUpdater::modifyField.

Bug: T346293
Change-Id: Icf91b35f7f729cead7c800429653eb30731762a1
2024-05-09 10:14:43 -04:00
Martin Urbanec
bab72e42c5 userOptions.php: Actually batch deletion
Prior to this patch, userOptions.php was missing
the LIMIT SQL clause, which means it was trying
to delete all rows within a single SQL query.

This patch adds the missing LIMIT, and userOptions.php
now actually batches when --delete is used.

Bug: T364311
Change-Id: Icc9311febbdda4dbda5280b466cd5483c578a7b1
2024-05-06 15:49:18 +02:00
Gergő Tisza
7b54bacc9c
foreign-resources: Add CycloneDX export support
Bug: T363589
Change-Id: Ic89041ff6f145a73d39d81eb4a4fd9f238f7e576
2024-05-05 15:15:16 +02:00
jenkins-bot
f0a2f1dd1d Merge "fix: use objectcachefactory methods instead of deprecated objectcache methods" 2024-05-05 11:08:07 +00:00
Irina Balaban
dc989f680f fix: use objectcachefactory methods instead of deprecated objectcache methods
Bug: T363770
Change-Id: Ie732f6925ec2b1316a60bebbe3c27f963c9dacb1
2024-05-05 12:40:30 +03:00
jenkins-bot
f99f308bf4 Merge "Drop 1.35 db updates" 2024-05-05 06:50:24 +00:00
Ollie Shotton
9d00ad742c Replace <> with !=
Change-Id: I167b13a0e7d03899e8d110cd78c867ed99ff6b94
2024-05-05 00:59:08 +01:00
Alexander Vorwerk
28bdd790ee Make rc_id a bigint
Wikidata is at 51.3% of its maximum value (see [1]), so we still have
comfortable time to make this change, but it will inevitably be
necessary and there is no point in postponing this change into the
future. The autoincrement value will not get smaller. ¯\_(ツ)_/¯

Also since rc only stores stuff for 30 days, the table is not that
big.

[1] - https://grafana.wikimedia.org/d/79S1Hq9Mz/wikidata-reliability-metrics?viewPanel=29&orgId=1

Bug: T63111
Change-Id: Icf3dc9815814ef73aa6a39f1c221a349e6b76872
2024-05-04 21:14:51 +02:00
Alexander Vorwerk
b2d44a162c Cleanup revision table schema
* Drop default value from rev_actor and rev_comment_id
* Make rev_id a bigint

Bug: T215466
Depends-On: I88318d7bcc063bc86a56eeb5f00048ea6e81964b
Change-Id: Id0a3d920e8b2dc8643fa3c0341b34ab3ed5761dc
2024-05-04 20:22:36 +02:00
jenkins-bot
75941ef4a2 Merge "Allow namespaces to be provided via arguments to generateSitemap.php" 2024-05-04 07:25:19 +00:00
jenkins-bot
8254591942 Merge "namespace MWDebug" 2024-05-03 21:43:37 +00:00
Amir Sarabadani
214674d6b1 namespace MWDebug
Bug: T353458
Change-Id: I99d728bd111ff882220cd175ff09d4da20b81eae
2024-05-03 22:59:47 +02:00
jenkins-bot
e1dca49927 Merge "maintenance: Use explicit join in select" 2024-05-03 20:40:57 +00:00
jenkins-bot
7c1219edb7 Merge "Propagate changes to Meta map to interwiki.list" 2024-05-03 20:35:26 +00:00
jenkins-bot
e0b55fdcc0 Merge "Fix typo in comment of GenerateSitemap::setNamespacePriorities" 2024-05-03 19:23:28 +00:00
Dreamy Jazz
ee11718e51 Allow namespaces to be provided via arguments to generateSitemap.php
Why:
* The generateSitemap.php script currently generates a sitemap
  using pages from the namespaces in the $wgSitemapNamespaces,
  or if this is not defined then all namespaces that currently
  have pages.
* However, being able to specify what namespaces should be used
  instead of using the site config is useful in the case of
  generating sitemaps ad-hoc and/or if that config is not set.

What:
* If the '--namespaces' argument is provided, then use it instead
  of checking for the site config or looking for all namespaces
  that are defined on the wikis.
* Use the namespaces provided in the namespace argument over the
  site config. If no namespaces are provided in the command line
  arguments, then check the site config.

Bug: T19748
Change-Id: If4a393605201be00200833c36b522bb34fcb651d
2024-05-03 18:08:52 +00:00
jenkins-bot
2f9cea98da Merge "maintenance: Use DatabaseSqlite for type-hinting instead of DBConnRef" 2024-05-03 17:22:32 +00:00
Pppery
c81b45488b Propagate changes to Meta map to interwiki.list
Bug: T71997
Change-Id: Ida22e616d72f011fdbb0cdc5509a7000d55e4e67
2024-05-03 12:59:59 -04:00
jenkins-bot
7acc4436d4 Merge "Update URLs in the default/fresh install list to use HTTPS where enabled." 2024-05-03 16:48:24 +00:00
Umherirrender
cda4e5abd6 maintenance: Use explicit join in select
Writing joins with the join() function of the SelectQueryBuilder makes
it easier to read instead of having a list of tables and the condition
in the where clause.

Change-Id: I4d52f73c1c07f68cd0d06f36f8e5696d0533d238
2024-05-03 18:26:22 +02:00
Dreamy Jazz
e623f6d08b Fix typo in comment of GenerateSitemap::setNamespacePriorities
The word 'namesspaces' is a typo and should instead be 'namespaces'.

Bug: T19748
Change-Id: I3d5ba6715f5906e1b657aacd3c5bb621e80815de
2024-05-03 19:21:47 +03:00
Umherirrender
4563e41f20 maintenance: Use DatabaseSqlite for type-hinting instead of DBConnRef
DBConnRef is internal, use of DatabaseSqlite class for this special
maintenance script seems valid.

Change-Id: I82c0085b9953367557f32c3ebb8dea3aacc9c1ae
2024-05-03 17:53:10 +02:00
jenkins-bot
7837877099 Merge "checkComposerLockUpToDate: Do not require LocalSettings" 2024-05-03 13:25:03 +00:00
Lewis Cawte
998f9ee059 Update URLs in the default/fresh install list to use HTTPS where enabled.
Change-Id: I3ef397a1ffe37f885fb66ebfb259532e819a0e2e
2024-05-03 14:08:48 +01:00
Alexander Vorwerk
bda3118e56 Drop 1.35 db updates
Per official policy, updates from versions older than two LTS releases
are not supported.

Change-Id: I8fb08e226c1a37580f95ee622a0703eee312d9ba
2024-05-03 12:53:12 +00:00
jenkins-bot
f0b51af6af Merge "Update list of default interwiki links" 2024-05-03 12:50:30 +00:00
jenkins-bot
0bf0b4d118 Merge "Fix MaintenanceRunner test failures on Windows" 2024-05-03 11:46:33 +00:00
Alexander Vorwerk
a032e322ab checkComposerLockUpToDate: Do not require LocalSettings
Change-Id: I3f549bb7c36f19041a3d50548e7eec1f1010dd87
2024-05-03 13:27:07 +02:00
Bartosz Dziewoński
8266ae0729 Fix MaintenanceRunner test failures on Windows
In the following test cases in MaintenanceRunnerTest.php:

  yield 'extension script path, using prefix'
    => [ 'FakeExtension:fakeScript.php', FakeScript::class ];

  // NOTE: assumes the class has been loaded by the previous test case!
  yield 'extension class, using prefix'
    => [ 'FakeExtension:FakeScript', FakeScript::class ];

…the noted assumption did not quite hold on Windows.

After including …/fakeScript.php, the class was indeed loaded. The
next case would use the loaded class, but before it did that, it
first tries to include …/FakeScript.php - which doesn't exist, but
it's the same as …/fakeScript.php on case-insensitive filesystems,
so the file was loaded twice, causing "Fatal error: Cannot declare
class MediaWiki\Extension\FakeExtension\Maintenance\FakeScript,
because the name is already in use in …\fakeScript.php on line 0".

Re-order some code in MaintenanceRunner, so that it tries to use the
existing class (or autoload it) before it tries to include the file.

Change-Id: Ic7ed7139bbede48097df59338c82688081688c3b
2024-05-03 09:26:06 +00:00
Alexander Vorwerk
00f7efc080 Update list of default interwiki links
updated list was proposed by Quiddity at T71997#8257757

Bug: T71997
Change-Id: Ie202678d04185250619e7413b88c158df99cce80
2024-05-03 09:07:26 +00:00
jenkins-bot
b0a948eeba Merge "rdbms: Remove IReadableDatabase::getReplicaPos()" 2024-05-01 12:16:23 +00:00
James D. Forrester
97f65c3836 Drop last references to JSDuck
* Update the maintenance Makefile to point to npm run doc and drop the custom file
* Drop sync references to the eg-iframe system, dropped in 5a3922a4a
* Drop a file from OOUI only imported for said eg-iframe system

Bug: T138401
Change-Id: Ic34c028ef6b43e2ba3dc6f215b6a1e7d94d97e0a
2024-05-01 08:02:42 +01:00
Amir Sarabadani
7f0458b472 rdbms: Remove IReadableDatabase::getReplicaPos()
Completely unused.

Bug: T363839
Change-Id: I041ab5ce57ef116076dcc07b2035b5336ceff032
2024-04-30 18:30:56 +02:00
Amir Sarabadani
8e183495e1 Stop using LoadBalancer::getConnectionRef() so it can be hard-deprecated
Bug: T326274
Change-Id: I90493d7cd4c21fdc022bcc19765fc04d986a9c8f
2024-04-30 13:31:08 +01:00
Tim Starling
917f0a5996 Replace all instances of "per default" with "by default"
According to the dictionary, "per" (or more conventionally "as per")
means "according to". Refer OED "per" sense II.3.a. For example:

"No value was passed, so return null, as per default".

In this sentence, we are not specifying the default, we are referring
to the default. This correct usage of "per default" was used nowhere
in MediaWiki core as far as I can see.

Instead we have "per default" being used to mean "by default", that is,
giving the value to use when no explicit value was specified.

In OED, the phrase "by default" is blessed with its own section just
for computing usage:

"P.1.e. Computing. As an option or setting adopted automatically by a
computer program whenever an alternative is not specified by the user
or programmer. Cf. sense I.7a."

There are highly similar pre-computing usages of the same phrase,
whereas the phrase "per default" is not mentioned.

As a matter of style, I think "per default" should not be used even
when it is strictly correct, since the common incorrect usage makes it
ambiguous and misleading.

Change-Id: Ibcccc65ead864d082677b472b34ff32ff41c60ae
2024-04-29 10:47:54 +10:00
Umherirrender
bf82200fff maintenance: Migrate to IReadableDatabase::newSelectQueryBuilder
Bug: T344971
Change-Id: Iacd0d77ee4ec747bd810b48e236637ee081debe6
2024-04-27 22:28:20 +00:00
Umherirrender
91760fc95b maintenance: Remove ActorMigration from removeUnusedAccounts.php
ActorMigration for rev_user is deprecated since 1.39

Change-Id: I832cd5ce7c63e2f7748e72a5cc199e1808ca3aef
2024-04-25 21:28:12 +02:00
jenkins-bot
4698bc40a0 Merge "maintenance: Use expression builder in cleanupPreferences.php" 2024-04-25 12:31:48 +00:00
Kosta Harlan
6efd008f33 TempAccounts: Rate limit acquisition of temp account names
Why:

- We don't want to allow unlimited acquisition of temp account names.
  These should be rate limited in similar way to how we limit the
  creation of temp accounts

What:

- Provide a TempAccountNameAcquisitionThrottle, and use it in the
  acquireName() method
- Set a default that is 10 times the limit of
  TempAccountNameCreationThrottle

Depends-On: If660aad1d0f04f366414084aff3f88484a19d416
Bug: T343101
Change-Id: I99d5973498a89ac227847de5837c0a8e895c28fb
2024-04-23 13:33:57 +00:00
jenkins-bot
2d116a3355 Merge "Use expression builder to avoid raw sql via BETWEEN operator" 2024-04-23 07:22:55 +00:00
Taavi Väänänen
9553121e2a
maintenance: Fix PSR2.Classes.PropertyDeclaration.Multiple errors
Change-Id: I9eb336837b21aa37327f571aad4f973592bdddf7
2024-04-21 23:06:00 +03:00
Taavi Väänänen
d66bd146e8
maintenance: storage: Fix multiple property declaration phpcs errors
Change-Id: I74302c9b2818e02d7d5e67a728558ced5e8f0181
2024-04-21 23:06:00 +03:00
Umherirrender
9bf5d724af maintenance: Use expression builder in cleanupPreferences.php
Also type-hint for IReadableDatabase

Depends-On: I15fc617eae8bc18c911525ea382e99e82b40011a
Depends-On: Ib77f8f409b48115684396bf920428adb075c2820
Change-Id: I09d07ba11e8cd6d288c1ed5ddea89b654e24cbb2
2024-04-21 20:52:43 +02:00
Umherirrender
fea5c2f687 Use expression builder to avoid raw sql via BETWEEN operator
Replace BETWEEN with >= and <= operator

Change-Id: Ic21b6f4cc11c773c967d9d4c5f20e762c2ff9629
2024-04-21 14:24:21 +02:00
Umherirrender
e10441e555 IReadableDatabase::select cannot return false
Remove check for false from IDatabase::select as this is not possible
A DBQueryError is thrown (documented since efda8cd3 / I056b7148)

Use IResultWrapper::numRows to check for empty IResultWrapper

This ignores includes\libs\rdbms as QUERY_SILENCE_ERRORS is an internal
option to get false from this function

Change-Id: I4b2fc26ca0e68612f6beadc01e68097a74962c84
2024-04-18 22:48:25 +02:00
Umherirrender
8018e157e8 maintenance: Migrate to IDatabase::newUpdateQueryBuilder
Bug: T353219
Change-Id: Ic278c8534dad40a3f34674db2d5fbfbca5984da8
2024-04-14 18:47:55 +00:00
Umherirrender
523372df32 Migrate to IDatabase::newDeleteQueryBuilder
Change-Id: Idf42d67c1b0b311f81a1d60a7a8a6f875f99e864
2024-04-12 20:12:05 +02:00
Brent Laabs
47b71b8cda Fix slash-delimited regex from CLI on maintenence/grep.php
Bug: T361991
Change-Id: I23b99e071340172db41beffc35746ce2e72b3bb1
2024-04-08 02:03:19 +00:00
Umherirrender
96ecf0f528 Fix use of ReplaceQueryBuilder::rows
Follow-Up: I446f7a09cfc0ee37c2e016052d452751f7333e27
Change-Id: Id8c56b1479860f4d8903e626b337362d10d6a8e0
2024-04-01 23:57:03 +02:00
Timo Tijhof
575c722477 maintenance/generateSitemap.php: Partially revert 676fcf43
Commit 676fcf43 changes various substr() calls to str_starts_with,
except in some cases it adopted `$str[0]` or `$str[-1]` notation
instead. The cases in question:

* includes/Request/PathRouter.php

  This one was safe since `$path` is already presumed to be non-empty
  earlier in the same function via `$path[0]`.

* maintenance/generateSitemap.php

  This one is not safe as the stting may be empty, leading to a
  warning for undefined offsets in some cases.

Bug: T361379
Change-Id: I008f7b390fa08a813a0e44e8c29671e705db64f0
2024-03-29 15:55:17 -07:00
jenkins-bot
00a4874bf7 Merge "docs: Update obsolete config as of Doxygen 1.9.8" 2024-03-28 17:01:34 +00:00
jenkins-bot
ef450facd3 Merge "allow maintenance/deleteBatch.php to accept page ID" 2024-03-28 12:37:53 +00:00
Timo Tijhof
eb34785244 docs: Update obsolete config as of Doxygen 1.9.8
Based on CI output, and what `doxygen -s -u` does automatically.
Diff minimised to only differences that fix warnings. Verbose
comments and copies of new default values are left uncommitted.

* HTML_TIMESTAMP=YES -> TIMESTAMP=YES
  Renamed in 1.9.7.
  https://github.com/doxygen/doxygen/commit/27933ab863

* FORMULA_TRANSPARENT=YES
  DOT_TRANSPARENT=YES
  No longer configurable since 1.9.5.
  https://github.com/doxygen/doxygen/commit/8b7822cb67

* DOT_FONTNAME=Helvetica -> DOT_COMMON_ATTR
  DOT_FONTSIZE=10        -> DOT_COMMON_ATTR
  Renamed in 1.9.5.
  https://github.com/doxygen/doxygen/commit/4bfd8297

  Matches default.
  https://doxygen.nl/manual/config.html#cfg_dot_common_attr
  > The default value is: labelfontname=Helvetica,labelfontsize=10.

* DIA_PATH
  MSCFILE_DIRS
  Moved to a different section by `doxygen -s -u`.

Change-Id: I6354dc34af3aba6c0132f31fd290154ae54942c4
2024-03-27 23:50:23 +00:00
Timo Tijhof
582cf3399c build: Restore Doxygen output for MediaWiki release tags (take 3)
Follows-up:
* I696f1e7ede (60f106e112): Apply `vendor` and `node_modules` exclude
  patterns even when `--file` is used to generate docs for an extension
  or a subset of core.

* I9313457796 (eaf491b4f4): Use faster and upstream supported EXCLUDE
  instead of EXCLUDE_PATTERNS for skipping whole top-level dirs.

Neither of these addressed the fact that this `if` condition is not
actually possible to reach because `explode()` always returns an
array with at least one item. e.g. `exclude(',', '') == [ '' ]`.

Test plan:
* `php maintenance/mwdocgen.php --output ./docs/ --version whatever`
* Review the contents the mentioned `/tmp/MWDocGen-*` file that is
  auto-generated.

Before:
```
INPUT                  =  ""
…
EXCLUDE                =  cache images
```

After:
```
INPUT                  =
…
EXCLUDE                =  cache images extensions skins
```

Bug: T317451
Change-Id: I871b321fa9fdb2d763fba532ab6248b0fc4b1701
2024-03-27 19:39:35 +00:00
Philipnelson99
4586afaad0 allow maintenance/deleteBatch.php to accept page ID
Added a flag (--by-id) to maintenance/deleteBatch.php that allows users to pass page IDs instead of titles.

Bug: T357019
Change-Id: I599f9fcc8d4cfd9e667717d5a575b05990141fb2
2024-03-27 16:02:44 +00:00
Timo Tijhof
d864855d5d docs: Remove use of $IP from mwdocgen.php
* Prefer the MW_INSTALL_PATH constant where possible.

* For input and output, there is no need to specify full paths,
  only to strip the prefix again afterwards.
  See also Doxyfile in any repo that is not mediawiki/core where we
  already set the path relative to the project directory, e.g.
  "src/" as input and "docs" as output.

  <https://codesearch.wmcloud.org/search/?q=INPUT%7COUTPUT&files=Doxyfile>

Test Plan:
* `php maintenance/mwdocgen.php --file docs,includes/libs/objectcache/`

Change-Id: I4119161accdc665d0e4d0d4e49d0c42c68f8e2a2
2024-03-26 23:30:10 +00:00
Kunal Mehta
903544aabc Update Apache config syntax in .htaccess files
"Deny from all" is deprecated; the replacement syntax has been
available since Apache 2.4 (originally released in 2012).

See <https://httpd.apache.org/docs/2.4/howto/access.html>.

Bug: T360850
Change-Id: I825053ccefe34f6ca4e04af5ad2601f79e4d51a7
2024-03-23 23:36:31 -04:00
Umherirrender
abffe0154f maintenance: Remove reference to removed populateCategory.php
Removed in 0dacf7d68d

Follow-Up: Id7fc111b71e8ee9a37a3e2e56849ac5afeea9f9d
Change-Id: I6f317785e2698d16f9dc944ef0f0c6fff78e7229
2024-03-21 21:32:43 +01:00
James D. Forrester
85d95dd458 Drop old class_aliases for before MW 1.39 that were missed
The RandomPage alias was dropped in an earlier commit, so
group the release note entry in with these.

Change-Id: I207d7463ced1a1bb8b8ac749eba175fc0037a217
2024-03-20 12:10:42 +00:00
Tim Starling
d7cb31fd1d migrateBlocks.php: Fix infinite loop
Don't go into an infinite loop if the batch contains only rows that are
skipped due to ipb_user === 0.

Change-Id: I2b8398bcc78267e80313ecc6e64033805d83fdef
2024-03-13 11:04:12 +11:00
jenkins-bot
9e212b86c2 Merge "migrateBlocks.php: Skip existing IDs" 2024-03-11 22:45:10 +00:00
Tim Starling
2ff4491860 migrateBlocks.php: Skip existing IDs
When copying blocks from ipblocks to the new block table, skip rows for
which the relevant ID already exists in the block table. In write-both
mode, it is expected that some blocks will have already been copied.
This also allows the script to be run multiple times on a wiki, so that
it can be used to clean up the current situation in production.

Bug: T355034
Change-Id: I54e65adef685bfc7d4f63853cd50ca0f55e2ecdb
2024-03-11 12:25:11 +11:00
Timo Tijhof
eaf491b4f4 build: Restore Doxygen output for MediaWiki release tags
Bug: T292237
Bug: T317451
Change-Id: I9313457796cb0c515a52c1860abfd5f86704641a
2024-03-09 02:44:23 +00:00
jenkins-bot
5bdb963919 Merge "TempUserConfig: Deduplicate code generating match conditions" 2024-03-07 11:22:18 +00:00
Bartosz Dziewoński
2cbc82edbb TempUserConfig: Deduplicate code generating match conditions
The idea is similar to the one behind TempUser\Pattern::toLikeValue(),
which has been effectively deprecated by allowing multiple patterns.

Change-Id: Iddb284bff21355deb8ceaa6925d3c2aea34d727e
2024-03-06 18:28:14 +01:00
jenkins-bot
3eaeedc5c2 Merge "Add TranslationAliasesDirs to specify special page aliases in JSON" 2024-03-06 16:51:34 +00:00
jenkins-bot
e57ce5a8f7 Merge "TempUserCreator: Use separate rate limit for temp account creations" 2024-03-06 14:07:15 +00:00
Kosta Harlan
08fef95627
TempUserCreator: Use separate rate limit for temp account creations
Why:

- The pathway to creating a regular account is different from that of a
  temporary account. It makes sense to rate limiting creation of these
  two types of accounts at different rates.

What:

- Add a TempAccountCreationThrottle config with a restrictive default
  that matches the existing production configuration of
  AccountCreationThrottle (6 creations per day)
- Update resetAuthenticationThrottle.php to support resetting the temp
  account creation throttle
- For now, not adding an equivalent hook for account creation throttle's
  ExemptFromAccountCreationThrottle

Bug: T357777
Change-Id: Ibf36ac96f717107bace6f0a3326f79ed129a1dfe
2024-03-06 14:41:15 +01:00
Abijeet
8ddc4ee2ef Add TranslationAliasesDirs to specify special page aliases in JSON
The TranslationAliasesDirs configuration allows defining translatable
aliases in JSON files. The value should be a name or names of folders
that contains files that have localized aliases. Each language should
have a separate file.

Currently, it supports defining special page aliases but in the
future can be extended to support magic words and namespace aliases.

The patch adds a script: ConvertExtensionsMessagesToTranslationAlias
that can be used to convert existing ExtensionMessagesFiles to the new
format.

Bug: T89947
Change-Id: Ief16a48a8dc8742854f67301791aa2a0b0531116
2024-03-06 18:13:28 +05:30
Reedy
93044d8d1e updateCollation: Minor cleanup
Change-Id: Idd11b15d7ae97d8769169f7e8a3d1c42f3139724
2024-03-02 23:10:28 +00:00
Reedy
4313b73df6 updateCollation: Explicitly cast $scale to int
Bug: T358949
Change-Id: I15c6c95bd2ccc2973465db75453ce6c0bc29b98a
2024-03-02 23:08:24 +00:00
James D. Forrester
fe1fbb3a5c build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Depends-On: I5349d3378b5acd04f0d7c60072a9b1e3dd8f2052
Change-Id: I3b7fd4c460418e72ed0c36febef75f41bad0afb1
2024-03-01 15:58:13 -05:00
jenkins-bot
2561f607fd Merge "maintenance: show broken replicas in getLagTimes" 2024-02-29 09:27:02 +00:00
jenkins-bot
845e69cb2e Merge "Namespace includes/cache" 2024-02-28 15:10:38 +00:00
Antoine Musso
d2789c6eb9 maintenance: show broken replicas in getLagTimes
When replication is broken to a host, its lag is returned as `false`
which was converted to an integer and thus yielding 0. That hides the
fact the replication is broken, specially when all other replicating
hosts have sub second lag.

Give a meaningful message when replication is broken, same as we did for
lag.php in Ibc88d2b86384a68b3cf6fe0d9739144247534821.

Bug: T358484
Change-Id: I321516cf054f23940e0f0944832b57a387434721
2024-02-27 22:52:14 +01:00
TheresNoTime
a60327b9df lag.php: Return replication stopped or errored instead of False
Bug: T358484
Change-Id: Ibc88d2b86384a68b3cf6fe0d9739144247534821
2024-02-27 10:48:49 +00:00
Antoine Musso
31bf78b058 maintenance: add test for lag.php
Test the output of maintenance/lag.php in both one off and continuous
reporting modes (when it is passed -r).  The test coverage gives the
basis to later adjust the script output, notably when a replication is
broken (which prints the misleading "false").

Bug: T358484
Change-Id: Ib2e5597e5cd3b9b1b71c1c61c12814be5c5e7091
2024-02-26 12:35:52 -05:00
jenkins-bot
75d44ddd05 Merge "[maintenance] Add Parsoid support to maintenance/parse.php" 2024-02-22 22:42:05 +00:00
daniel
d5d585b9b2 TestSetup: avoid "premature access to service container"
TestSetup uses CheckComposerLockUpToDate to check if the composer
dependencies are up to date. CheckComposerLockUpToDate uses wfMessage to
generate localized output, which will fail since TestSetup runs before
MediaWikiServices is initialized.

Change-Id: I995a1cb01abcde7ebe2282b82d33cb50c31587a6
2024-02-21 17:24:17 +01:00
C. Scott Ananian
13436a1a8f [maintenance] Add Parsoid support to maintenance/parse.php
Use the --parsoid CLI option to get Parsoid output.

Change-Id: I6d30eb7759eb9ddc40e87545d3344274d155d55b
2024-02-20 12:16:25 -05:00
James D. Forrester
35b2542895 Namespace includes/cache
Bug: T353458
Change-Id: Ic3f3168ef17113f5fb3ec11e0a47f52d65eefba9
2024-02-20 10:28:03 -05:00
jenkins-bot
c8bb4c3a1e Merge "userOptions: Add support for --delete-defaults" 2024-02-20 09:36:12 +00:00
James D. Forrester
060a1b1668 Replace last remaining wfGetDB() calls in core, except ResourceLoader
Bug: T330641
Change-Id: I6d30af6ff9f667e367d39befb80c2bb0bf5fb29e
2024-02-14 11:02:01 -05:00
James D. Forrester
54a934e24d maintenance: Use getServiceContainer() when in instances of Maintenance
Change-Id: I00caa744deb805f4156eebee92068025f2aea2a4
2024-02-13 19:25:23 +00:00
Chiefwei
7555eb2ef7 Chinese Conversion Table Update 2024-1
Update the Chinese conversion table routinely to fix bugs reported at
https://zh.wikipedia.org/wiki/Wikipedia:字词转换/修复请求.

It is only data changes and only works for Chinese WikiProjects.

Change-Id: I71591d77028d818dc20e04b9be4508e74c127f83
2024-02-13 17:26:18 +00:00
Martin Urbanec
ab7945c25d userOptions: Add support for --delete-defaults
As part of using conditional defaults in Echo, database
rows matching the current defaults should be deleted. This
is easiest to do by a maintenance script that iterates through
all rows for that option

While this is slow, there is no other way to process conditional
defaults. The slowness should not be an issue, because the script
will be ran as a one-off cleanup action.

Bug: T355367
Change-Id: Id60856f9942a06dc494e539f488ce3789353f88a
2024-02-10 23:57:04 +01:00
jenkins-bot
43876fb2fa Merge "namespaceDupes: Fix fatals caused by READ_NEW and WRITE_BOTH" 2024-02-10 21:36:07 +00:00
jenkins-bot
bca2f1281e Merge "Schema: Drop iwl_prefix_from_title from iwlinks" 2024-02-09 16:39:59 +00:00
Brooke Vibber
dcd9c3ae26 Update name & email for bvibber
Updating name & email addresses for Brooke Vibber.

Re-ran updateCredits.php as well so there are some new entries in
there as well.

There are a couple of files in resources/libs that will have to
be changed upstream to keep tests happy, I will do patches
later. :D

Change-Id: I2f2e75d3fa42e8cf6de19a8fbb615bac28efcd54
2024-02-08 17:02:16 -08:00
James D. Forrester
4bae64d1c7 Namespace includes/context
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
2024-02-08 11:07:01 -05:00
Amir Sarabadani
f0bfc3d433 Schema: Drop iwl_prefix_from_title from iwlinks
After exhuastive research, we concluded that iwl_prefix_from_title is
not used and in case it's actually used, other indexes provide enough
cardinality.

This table is about to grow quite large in Commons, let's avoid making
it bigger than it needs to be.

Bug: T343131
Change-Id: I89e40dff384291968d2465e4109a3d212ae2f8c7
2024-02-08 17:01:26 +01:00
Amir Sarabadani
bfc64fabf4 namespaceDupes: Fix fatals caused by READ_NEW and WRITE_BOTH
If it's WRITE_BOTH, means the old fields also needs updating but since
it's READ_NEW, the fields are set to linktarget fields. That is wrong.

Bug: T350431
Change-Id: I6512d8b119861ff7e6016202e8c36da0536a9b26
2024-02-08 13:23:58 +01:00
C. Scott Ananian
0de13d7662 Add ParserOutput::{get,set}RenderId() and set render id in ContentRenderer
Set the render ID for each parse stored into cache so that we are able
to identify a specific parse when there are dependencies (for example
in an edit based on that parse).  This is recorded as a property added
to the ParserOutput, not the parent CacheTime interface.  Even though
the render ID is /related/ to the CacheTime interface, CacheTime is
also used directly as a parser cache key, and the UUID should not be
part of the lookup key.

In general we are trying to move the location where these cache
properties are set as early as possible, so we check at each location
to ensure we don't overwrite a previously-set value.  Eventually we
can convert most of these checks into assertions that the cache
properties have already been set (T350538).  The primary location for
setting cache properties is the ContentRenderer.

Moved setting the revision timestamp into ContentRenderer as well, as
it was set along the same code paths.  An extra parameter was added to
ContentRenderer::getParserOutput() to support this.

Added merge code to ParserOutput::mergeInternalMetaDataFrom() which
should ensure that cache time, revision, timestamp, and render id are
all set properly when multiple slots are combined together in MCR.

In order to ensure the render ID is set on all codepaths we needed to
plumb the GlobalIdGenerator service into ContentRenderer, ParserCache,
ParserCacheFactory, and RevisionOutputCache.  Eventually (T350538) it
should only be necessary in the ContentRenderer.

Bug: T350538
Bug: T349868
Followup-To: Ic9b7cc0fcf365e772b7d080d76a065e3fd585f80
Change-Id: I72c5e6f86b7f081ab5ce7a56f5365d2f75067a78
2024-02-07 21:22:06 -05:00
Gergő Tisza
cea267467a
createBotPassword: Use plain text for rights info
Follows up If3b9bce2f02806572cc6cc1194a07cb7d5b8d6da.

Change-Id: I022bb5727027e5ceb3ca1d31d431e903296e7b44
2024-02-04 18:36:46 -08:00
jenkins-bot
104590040e Merge "psysh: Reset ObjectCache instances when custom logging is used" 2024-02-02 12:16:23 +00:00
jenkins-bot
0ecd8c151d Merge "namespaceDupes: Reduce batchsize to 100 for link update" 2024-02-01 15:43:01 +00:00
Amir Sarabadani
616744db1d Schema: Drop unused and useless indexes of sites table
This table has eight indexes plus PK. It has around 1000 rows only. Even
if it needs these indexes (which it doesn't), they are still useless.

Looking at the code, the only potential useful index is the one on
site_global_key, they are showing up in the report of unused indexes in
the db and I checked with Fandom (which might benefit from an index on
this table) and they said they don't use sites table.

Bug: T342856
Change-Id: I06b3db0f33bd35bfa68f4b418d8c2f4b9b988409
2024-02-01 15:32:05 +01:00
Alexander Vorwerk
0c7eb5393a namespaceDupes: Reduce batchsize to 100 for link update
Change-Id: I3718041a97d6ba39d8953211b80f64af06c9da77
2024-01-31 23:58:17 +01:00
Samuel Guebo
15402237af Split User::getRightDescription into two methods
- Add getRightDescriptionHtml() to return HTML
  the change handles cases where the message contains wikitext
- Use the new method getRightDescriptionHtml() in createBotPassword

Bug: T312819
Change-Id: If3b9bce2f02806572cc6cc1194a07cb7d5b8d6da
2024-01-31 15:28:37 -05:00
Reedy
1d5a25aa65 updateCollation: Fix output of spacing text
Before:
```
Updating category collations...Selecting next 100 pages from cl_from = 0...  processing...0 done.
Selecting next 100 pages from cl_from = 100...  processing...0 done.
Selecting next 100 pages from cl_from = 200...  processing...0 done.
```

Change-Id: Ib55854f38506c5f7e0c09c530bc4f66285c29e60
2024-01-30 15:47:49 +00: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
525bd9a10e Merge "Schema: Drop cl_collation_ext index" 2024-01-29 17:58:31 +00:00
Reedy
e2f9bea62b Fix casing of Mediawiki to MediaWiki
Change-Id: I0f266a034a99255b27fd96d82335d6e710a61f20
2024-01-29 17:15:04 +00:00
jenkins-bot
9db4dbf46d Merge "Add a maintenance script to populate user_is_temp column" 2024-01-29 15:32:58 +00:00
Daimona Eaytoy
4637824f68 Replace unchecked MWException with SPL exceptions
Bug: T328220
Change-Id: I4e0454ce3ad3741756e2010a76e548d6c9a6bcb5
2024-01-28 22:41:46 +01:00
jenkins-bot
49a1821628 Merge "maintenance: Acquire new linktarget in namespaceDupes.php" 2024-01-26 16:45:48 +00:00
Amir Sarabadani
f056a26242 Schema: Drop cl_collation_ext index
Unused since Ie4dd91ee29308c980e

Bug: T342854
Change-Id: I3acf563c64ff176ade3e0c6745839a168e92473b
2024-01-26 16:16:41 +01:00
Umherirrender
cf30bf6984 maintenance: Acquire new linktarget in namespaceDupes.php
The use of LinksMigration::getLinksConditions returns 1=0 when there is
no lt_id in the linktarget.
Aquire a new id instead of a fatal sql error as update to 1=0 is invalid

Bug: T341993
Follow-up: I01c3a545248b06d1f73aa99dd898f60767482c8f
Change-Id: I264d366adb4588cbcfb14d52c4a56a05edeef8c1
2024-01-25 21:11:32 +01:00
jenkins-bot
3a49405285 Merge "maintenance: Fix broken strpos in findDeprecated script" 2024-01-25 16:11:09 +00:00
thiemowmde
f48161c5e2 maintenance: Fix broken strpos in findDeprecated script
The idea here was obviously to speed up the process by skipping files
that don't contain the substring "@deprecated" anywhere. Only these
files are parsed and traversed – which can be expensive.

The problem is that PHP's strpos() function never returns -1. It
returns false.

This patch doesn't change what the script does. It just runs faster.

Change-Id: I95a5a0fd3e024ec4132f53d770e3f61031d81250
2024-01-25 15:46:09 +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
b04e172c49 Merge "maintenance: Replace unnecessary uses of LBFactory and LoadBalancer" 2024-01-23 18:09:15 +00:00
Bartosz Dziewoński
166748e3ac maintenance: Replace unnecessary uses of LBFactory and LoadBalancer
* Change `$services->getDBLoadBalancerFactory()->waitForReplication()`
  to `$this->waitForReplication()`
* Change various complicated expressions to `$this->getReplicaDB()`
  and `$this->getPrimaryDB()`
* Remove unused variables

Change-Id: Ia857be54938a32bb6288dcdf695a35cd38761c3c
2024-01-23 16:48:36 +00:00
Daimona Eaytoy
7acfa6a0a5 Replace more instances of unchecked MWException
Most (all?) of the remaining usages are caught somewhere and will be
migrated later.

Bug: T328220
Change-Id: I5c36693a5361dd75b4f1e7a0bab5ad48626ed75c
2024-01-23 16:20:53 +00:00
jenkins-bot
5390bf325d Merge "updateCollation: Simplify and redo how batching works" 2024-01-23 16:09:41 +00:00
Amir Sarabadani
014bc61006 Remove more indirect calls to IDBAccessObject::READ_* constants
Found via (?<!IDBAccessObject)::READ_

We are planning to deprecate and remove implementing IDBAccessObject
interface just to use the constants.

Bug: T354194
Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
2024-01-23 15:42:38 +01:00
Amir Sarabadani
16b468b515 updateCollation: Simplify and redo how batching works
Long time ago, when we changed collation way more often and the HDD was
the norm for databases, indexing on cl_collation helped us speed up the
updates and minimize user impact. That's not the case anymore and on top
of that, we now have feature of copying the table via setting
--target-table and there is no need to run the schema change super fast.

Also, categorylinks table is quite large (in Commons it has reached
210GB, comparable to enwiki's revision table) and an extra index like
that is quite taxing on the infra.

So let's just do whatever other scripts do, go through all rows in batches
and take advantage of cl_from index instead. This is similar to what
migrateLinksTable does.

Bug: T342854
Change-Id: Ie4dd91ee29308c980ec0b9b7ee684cb175ffca43
2024-01-22 20:10:11 +00:00
Bartosz Dziewoński
4deac8b075 Fix type hint in shell.php
Follow-up to ee91e0f2eb.

Change-Id: I6ff8fc310436cd378d813c44033d15256159d814
2024-01-22 14:20:05 +01:00
jenkins-bot
2c85098361 Merge "Allow shell.php to run without LocalSettings.php" 2024-01-20 17:23:11 +00:00
jenkins-bot
22b643cf46 Merge "maintenance: Introduce getReplicaDB() and getPrimaryDB()" 2024-01-20 17:22:48 +00:00
daniel
ee91e0f2eb Allow shell.php to run without LocalSettings.php
The shell.php environment may be useful for testing and debugging even
without a configured MediaWiki instance. Allow it to run without
LocalSettings.php.

Change-Id: I738679384ee8065826f05148829cd04aa9f52efd
2024-01-20 17:02:52 +00:00
Thalia
2e70d36e99 Reword documentation for user.user_is_temp to clarify purpose
Clarify that this column is for external tools that only have
access to the database, and that it should not be used within
MediaWiki.

This is to avoid there being two different ways to look up if a
user is temporary. Parsing the name is preferred within MediaWiki,
because it can be done directly from the client and it corresponds
to how other user types are determined (e.g. external users).

The need for this column indicates technical debt, specifically
the need for a user type system, discussed in T336176. It is
considered temporary and replaceable by whatever system is
designed.

Bug: T333223
Change-Id: I94ec08daf78e76273ca055d21f5cea85021490c4
2024-01-19 20:00:05 +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
Amir Sarabadani
d9370003fb maintenance: Introduce getReplicaDB() and getPrimaryDB()
And start using them instead of wfGetDB(), LB/LBF connection methods or
worse, $this->getDB().

$this->getDB() reuses the database object regardless of whether you're
calling a replica or primary, leading to returning a replica on a
primary and other way around.

Bug: T330641
Change-Id: I9e2cf85ca277022284fc26b9f37db57bd12aaa81
2024-01-18 15:12:04 +01:00
Martin Urbanec
8cfb67dc70 userOptions: Use hasOption( 'old' ) instead of if ( $old )
The --delete mode of userOptions script checks whether
the --old argument was passed via `if ( $old )`. Unfortunately,
when someone does `--old ''` or similar, that check evaluates to false,
and the up_value condition is not added, resulting in more rows
being deleted than intended.

Bug: T355310
Change-Id: Ia479bc12808560700a5f404abb503e58aa729063
2024-01-18 13:08:05 +01:00
jenkins-bot
924d905cfb Merge "maintenance: Migrate to expression builders" 2024-01-17 21:37:27 +00:00
Amir Sarabadani
69cabb628c maintenance: Migrate to expression builders
This was somehow left out

Bug: T210206
Change-Id: I70851b5b99fa865dbfd629caf2c1866c85418350
2024-01-17 20:27:08 +01:00
jenkins-bot
e462a9275d Merge "Support multiple matchPatterns in temp user autocreate config" 2024-01-17 17:25:04 +00:00
jenkins-bot
fd3622e992 Merge "Migrate some usages of Database::update() to UpdateQueryBuilder" 2024-01-17 15:48:21 +00:00
Alexander Vorwerk
0831905a45 Migrate some usages of Database::update() to UpdateQueryBuilder
Bug: T353219
Change-Id: I98bf4c2e2c3023fba226ac10826e52a1108b8aea
2024-01-17 15:24:45 +00:00
Dreamy Jazz
7f588780a0 Support multiple matchPatterns in temp user autocreate config
Why:
* There is a need to update the generation and match pattern on
  WMF wikis to a new format that includes the year and starts with
  `~`. As such, the 'matchPattern' key needs to be updated.
* Removing the old 'matchPattern' from the wgAutoCreateTempUser
  config currently leaves existing temporary accounts as no longer
  recongnised as temporary accounts.
* Instead, the 'matchPattern' needs to be able to take an array of
  string patterns so that old patterns can still be used for matching.

What:
* Update the MainConfigSchama to indicate that 'matchPattern' in the
  wgAutoCreateTempUser config can be an array of strings.
* Add TempUserConfig::getMatchPatterns and deprecate TempUserConfig::
  getMatchPattern. This is needed because ::getMatchPattern was typed
  to only ever return one Pattern, which is no longer the case with this
  config change.
* Update the RealTempUserConfig to support multiple patterns defined in
  the 'matchPattern' key. The RealTempUserConfig::getMatchPattern method
  returns the pattern or first pattern if multiple are defined to allow
  time for existing usages of this deprecated method to be updated.
* Update the RealTempUserConfig to rely on other methods instead of checking
  object property values where possible (e.g. use ::isEnabled instead of
  checking $this->enabled) to allow easier unit testing.
* Update UserSelectQueryBuilder and ChangesListSpecialPage to use TempUserConfig
  ::getMatchPatterns instead of ::getMatchPattern.
* Update mediawiki.util/util.js to be able to parse the 'matchPattern' value
  when it is an array of strings.
* Update maintenance/userOptions.php to use ::getMatchPatterns instead of
  ::getMatchPattern.
* Add and update unit and integration tests for the new code, as well as
  expanding coverage over existing code that was indirectly affected.

Bug: T354619
Change-Id: I3763daefe4dc7c76370bd934fb20452591c9c762
2024-01-17 11:24:26 +00:00
Martin Urbanec
00417f2b35 userOptions: Do not crash on temporary accounts
Why:
Since T354417 added support for --old to be the default value
for an option, userOptions.php can run into temporary accounts.
Because temporary accounts don't have user options, they always
have the default setting. The T354417 change means userOptions.php
can now encounter temporary accounts.

What:
Avoid changing user options for temporary accounts by filtering
them out in the query builder template.

Note:
I am aware of I122f001ab24e879a573b19468d642b8f579d1024,
which deprecates getMatchPattern, but I am uploading this
as a separate patch, because I need userOptions.php to work
in Wikimedia beta ASAP.

Bug: T355204
Change-Id: I3fdceccb9019aabd42934e44033bdd0190fa00e8
2024-01-17 10:36:56 +01:00
Reedy
3e4fcfb1d3 reassignEdits.php: Add missing done after ip_changes
Change-Id: Ie69553998bf53602f4fc0d28371748edd7c30483
2024-01-16 20:54:01 +00: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
jenkins-bot
72079ef2fc Merge "libs/composer: Namespace under Wikimedia\Composer" 2024-01-14 04:28:32 +00:00
jenkins-bot
3441aa1a13 Merge "userOptions: Support --old being the option's default value" 2024-01-13 23:49:46 +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
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
Martin Urbanec
586a6d041c userOptions: Support --old being the option's default value
Prior to this patch, userOptions.php couldn't be used
to change an option's value from its default to a new value,
since the script strictly expected $from to equal up_value
in user_properties, which never happens if $from is the default
value.

This patch fixes this by doing a LEFT JOIN and examining
missing user_properties rows (ie. cases when up_value is NULL).
For each such case, $from is compared with the default value
for the given user and if it matches, the option is changed.

To ensure this querying does not take long time when it is not
actually required, the new behaviour only applies
when --old-is-default is passed.

Bug: T354417
Change-Id: I95781588e9b494ef479790368e557c9182bdb6f8
2024-01-12 14:51:09 +01: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
bd2031e0f4 Merge "Add the new block and block_target tables" 2024-01-11 03:24:24 +00:00
Martin Urbanec
cdbf7e4eb9 userOptions: Fix the 'ALL USERS' message display condition
$from is not the first ID, but the old up_value.
We also need to check both the first ID and last ID
are undefined, not only the first one.

Change-Id: I559f06055c8e76ccc3d320ef4fbc6350859de062
2024-01-09 10:11:04 +01: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
Umherirrender
f4e005971c Use assoc array for column alias in select queries
Simplify writing the alias by using 'alias' => 'function' syntax.

Change-Id: I9d96550c957d4dd4ea065d8ad93b6d3f07ac3483
2024-01-08 21:47:45 +01:00
jenkins-bot
2aa40c2803 Merge "ResourceLoader: Switch validateScriptFile() from JSMinPlus to Peast" 2024-01-08 15:06:59 +00:00
daniel
cea8aee05e Make Maintenance::finalSetup require a SettingsBuilder
Maintenance::finalSetup should have access to a SettingsBuilder so it
can manipulates config settings without resorting to global variables.
MaintenanceRunner will always provide a SettingsBuilder when calling
this method, so implementations should be able to rely on always getting
one.

The $settings parameter was introduced as optional in order to maintain
backwards compatibility with implementations that did not declare the
parameter. But these should all have been fixed since.

Depends-On: I8a3699b13bfb4dc15f3bed562731ed9d525651cc
Change-Id: I334a103e02fd905faafc43c7c5b95996bc91fd18
2024-01-08 09:40:18 -05:00
Tim Starling
fd9c7c2d3e Add the new block and block_target tables
Bug: T346293
Change-Id: I3822ad03227405a608dea1d788bcdb8321b95bb3
2024-01-08 14:29:59 +11:00
Dogu
54b1731f88 Replace deprecated wfParseUrl with UrlUtils::parse
The wfParseUrl function is deprecated as of MediaWiki 1.39 and has been
replaced with the UrlUtils::parse method provided by the UrlUtils class.

List of affected classes:
- deleteSelfExternals
- UserMailer

Change-Id: I5e36ee80e5c30e95b79bf45e7b26860cb2668d56
2024-01-07 10:24:37 +00:00
Timo Tijhof
53a3c8b417 ResourceLoader: Switch validateScriptFile() from JSMinPlus to Peast
This adds support for ES6 and ES7 syntax to user scripts, thus
matching the wikimedia/minify library.

Bug: T75714
Depends-On: I43d4619a32e37eb42e1aaa55a1f602962609c52b
Depends-On: If3b2b4a75013baeaa0d9b92cd10dfb06e5534153
Change-Id: Ie309e761f8b20640f7c0e85def0a3d1ccc8a658e
2024-01-06 22:33:46 +00:00
Thalia
caf9912323 Use year in temporary user names and restart index each year
Why:

* Part of a temporary user name is generated from an index that
  increments, which is stored in the database.
* As specified in T345855, the index will be restarted each year.
* Also specified in T345855, the year will be included in
  generated temporary user names.

What:
* Since the year must be included in the name in order to avoid
  naming conflicts if the index is restarted each year, both are
  implemented together and controlled by a single config.
* Add a new config option that, when true, restarts the name
  generation index at the start of each year and add the year into
  the user name: $wgAutoCreateTempUser['serialProvider']['useYear']
* Add a uas_year column to the user_autocreate_serial table, which
  is unique in combination with uas_shard, so the index can be
  stored for each shard/year combination.
* The year is added into the username just after the prefix, as
  specified in T345855. This is based on research that having the
  year near the start of the name aids understanding that the
  names are not IP addresses. The position of the year within the
  name is therefore not configurable (though whether to include
  it is). See T345855 for the research.

Bug: T349494
Bug: T349501
Depends-On: I6b3c640a4e74f52fd4a4f46de5a2cbe80fe3b665
Change-Id: If51acb3f4efa361ce36d919c862a52501a5a7d24
2024-01-05 17:14:19 +00:00
abador
cf87040da3
CleanupUploadStash: change fatalError to output and continue temp file cleanup if temp directory isn't located in local-temp
Bug: T283479
Change-Id: I64d4c7a938cb0944604289a3c101481ecf2c2137
2024-01-02 19:55:36 -08:00
abador
47f3071564
CleanupUploadStash: return exit code 0 when local temp repo is not present
Return return exit code 0 instead 1 when local temp repo is not present

Bug: T283479
Change-Id: I7a0791d9bfb19607999aaebfb7d5c2a94b20c8ca
2024-01-02 19:54:56 -08:00
Bartosz Dziewoński
b2c83a0721 Deprecate $wgCommandLineMode
The global variable is now exactly the same as
`MW_ENTRY_POINT === 'cli'`.

Bug: T313841
Change-Id: I254bf4aa426e4834705be351cc9eb06d18a33f79
2024-01-02 22:21:50 +01:00
Bartosz Dziewoński
6876ccf177 Replace $wgCommandLineMode checks with MW_ENTRY_POINT in other places
I'm not sure if there's a good way to split this up into
logical chunks.

Bug: T313841
Change-Id: I3b35a2e475b5143f383d4085fbc6a0ed3bbc32b8
2024-01-02 22:17:14 +01:00
jenkins-bot
f449aebe6f Merge "maintenance: Migrate to DeleteQueryBuilder" 2024-01-02 19:41:45 +00:00
Amir Sarabadani
5a3e6564e4 maintenance: Migrate to DeleteQueryBuilder
Bug: T353219
Change-Id: Iecb55ab3f905ee9ed4e32e9cbb58c36f8cacf669
2024-01-02 13:13:49 +01:00
jenkins-bot
5522c780a5 Merge "maintenance: Remove dev folder" 2024-01-01 20:24:44 +00:00
Umherirrender
3f9d716653 maintenance: Remove dev folder
Using php5.6, which is outdated for use with MediaWiki

Use quickstarts described at DEVELOPERS.md for supported versions

Change-Id: I1001d50ecd60d4bc8c836e2aa22ffb57c1b2b859
2023-12-31 10:33:14 +00:00
jenkins-bot
ef29325971 Merge "Migrate remaining Database::insert calls to InsertQueryBuilder" 2023-12-22 14:19:25 +00:00
Amir Sarabadani
72a7b74ea9 Migrate remaining Database::insert calls to InsertQueryBuilder
Tests are not checked.

There is nothing left as far I can check.

Bug: T353219
Change-Id: I1d58397118c7ab1110b9d7cf400c59c4bff7378c
2023-12-22 14:53:17 +01: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
Winston Sung
d815fa01d8 Maintenance: Fix RebuildTextIndex
RebuildTextIndex require rev_comment_id in
* CommentStore::getCommentLegacy
* CommentStore::getCommentInternal

Follow-up of commit 049b34b41c
(Change-Id Ifd690dc8f030f86e3567a717eaeb830cb6dc703b).

Bug: T344971
Change-Id: Ie5d6ad4233106ddfa7f230c0f8f72ba43cd7dcac
2023-12-18 11:53:24 +01:00
James D. Forrester
9bfb75ff90 Namespace ParserOutput
Most used non-namespaced class!

Bug: T353458
Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
2023-12-14 14:57:34 -05:00
James D. Forrester
4cf719019a Namespace remaining files in includes/site
Bug: T353458
Change-Id: I38da09f28cd68add721ba7b05f351acb56515d95
2023-12-14 14:57:34 -05:00
jenkins-bot
747c1cac86 Merge "Fix typo in maintenance script" 2023-12-13 13:46:58 +00:00
Niklas Laxström
7a16479719 Fix typo in maintenance script
Change-Id: Ia8ea294b7bc961fe34dd4457a8eabc27f41c4056
2023-12-13 10:32:17 +02:00
Umherirrender
4b555ad4d9 maintenance: Add missing parenthesis to SQL in attachLatest.php
Error 1064: You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near 'FROM `revision`    WHERE rev_page = 42  LIMIT 1' at line 1
Function: AttachLatest::execute
Query: SELECT  MAX(rev_timestamp  FROM `revision`    WHERE rev_page = 42
LIMIT 1

Follow-Up: Idfe83b900de3fbc6a251a5a78d8af1a4cd88970f
Change-Id: Ibdb4bdc68f10f87c53ae648674c1c1729e2ba2b2
2023-12-12 22:16:32 +01:00
Tim Starling
9c02258a04 Use thousands separators in selected integer literals
For readability. Allowed since PHP 7.4.

I searched for integer literals of 6 or more digits, and also changed
some nearby smaller numbers for consistency.

Bug: T353205
Change-Id: I8518e04889ba8fd52e0f9476a74f8e3e1454b678
2023-12-12 09:22:45 +11:00
jenkins-bot
744cbe58d5 Merge "WikiImporter: Pass Authority for permissions instead of global context" 2023-12-11 19:49:54 +00:00
Bartosz Dziewoński
64001f0ecd WikiImporter: Pass Authority for permissions instead of global context
Pass Authority to WikiImporter constructor, instead of looking at the
user from RequestContext::getMain(), and skipping this check if
$wgCommandLineMode is true.

Maintenance scripts now use UltimateAuthority, to match the original
intent of skipping permission checks, see 2ed55f42 / r96311.

The Authority parameter to WikiImporterFactory::getWikiImporter() is
optional for now for backwards-compatibility. It should become
required later after deprecation.

Change-Id: Iea1d03dcdcbda2f9a9adbff1b0d319efd22c4d86
2023-12-11 19:15:11 +01:00
Umherirrender
72d6b46339 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements and changes to docs done manually

Change-Id: I443aada1c18c8628b02671aa9fd6f441961e5c2e
2023-12-11 16:07:18 +01:00
Bartosz Dziewoński
6183896a0f TempUser\Pattern: Use SQL expression builder instead of buildLike()
Bug: T350969
Change-Id: I44bb326539f68b1c6591a015424940a9c7de5030
2023-12-06 18:20:39 +00:00
jenkins-bot
108d4f399d Merge "rdbms: Change docs for IDatabase::affectedRows on UPDATE IGNORE" 2023-12-04 20:40:40 +00:00
jenkins-bot
5647a61dec Merge "docs: Remove further references to jsduck" 2023-11-30 00:30:28 +00:00
Jon Robson
5a3922a4af docs: Remove further references to jsduck
Bug: T138401
Change-Id: I80739776e2fa55536d51e2d7e2743d337bd54135
2023-11-30 00:11:27 +00:00
Kosta Harlan
06176a71b4
mw-install:sqlite: Load DevelopmentSettings
Why:

- We want developers to have DevelopmentSettings loaded by default

What:

- Define a new `--with-developmentsettings` argument for install.php,
  Set it to true in the `composer mw-install:sqlite` invocation

For now, this option is not supported in the web installer.

Bug: T347347
Change-Id: Icba2d614fd1349463fb745ef31f53a3b3834e5ad
2023-11-29 10:00:48 +01:00
Tim Starling
d6727856fd Support new block schema
Support migration stages when reading and writing blocks.

I tried to set it up for an easy next stage, in which support for the
old schema is removed. I tried to avoid factoring out of shared code
between the two schemas, so that the old schema cases can simply be
deleted without the need to revert unnecessary abstractions.

However, I added HideUserUtils to factor out ipb_deleted queries. Code
review showed that this was already quite complex, with multiple
approaches to the problem, so it benefits from refactoring even without
the schema abstraction.

HideUserUtils is a service rather than a standalone class to support
unit tests, since unit tests do not allow global config access. When
the migration stage config is removed, it will be a service with no
constructor parameters -- an unnecessary abstraction which should
ideally be resolved at that time.

When interpreting result rows, it is possible to share code by using
field aliases. But when constructing WHERE conditions, the actual field
names need to be used, so the migration is more intrusive in
ApiQueryBlocks and SpecialBlockList, where complex conditions are used.

Bug: T346293
Bug: T51504
Bug: T349883
Change-Id: I408acf7a57b0100fe18c455fc13141277a598925
2023-11-29 13:31:42 +11:00
jenkins-bot
24c2a90198 Merge "Revert "Disable namespaceDupes.php for now"" 2023-11-28 21:59:31 +00:00
Amir Sarabadani
f6b9b933b9 sqlite: Fix pagelinks schema patch
Bug: T351619
Change-Id: I52304efae870fcbe14dbacbff20ff69d6481c71c
2023-11-28 15:37:10 +01:00
Zoranzoki21
93e9331d90 Revert "Disable namespaceDupes.php for now"
This reverts commit 8b1532d4dd.

Reason for revert: Because of recent changes to the script,
it should be safe to use it again.

Bug: T350443
Change-Id: I56593542bb0676792251d7e966b31be69be437bb
2023-11-23 17:32:09 +00:00
jenkins-bot
dcd8a21d56 Merge "Replace use of "unquoted" with "raw" for tableName() callers" 2023-11-23 03:06:04 +00:00
James D. Forrester
67217d08df Namespace remaining files under includes/deferred
Bug: T166010
Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
2023-11-22 10:08:53 -05:00
Umherirrender
c18785f57d rdbms: Change docs for IDatabase::affectedRows on UPDATE IGNORE
IDatabase::affectedRows does not return the affected rows for UPDATE
IGNORE as mention in the docs, it returns the matching rows and making
IDatabase::affectedRows not usable to determine if update has update the
row or not, reverting usage in namespaceDupes.php (01a548cc)

Change-Id: Ia3b7cd034731da9c7067a11a3bfa51c81a4c5530
2023-11-21 21:50:10 +01:00
Umherirrender
baa4ceea55 maintenance: Batch delete for key conflicts in namespaceDupes.php
Limit the deletion of key conflicts for the links table to
$wgUpdateRowsPerQuery rows.

Also use IDatabase::factorConds to build the condiiton

Bug: T350443
Change-Id: I64ec5a01b457a395a1e830c28aabbc2dd3c0f539
2023-11-21 20:32:50 +01:00
Aaron Schulz
1dd273b8ff Replace use of "unquoted" with "raw" for tableName() callers
Change-Id: I4fed3a901ef212b1f502e7f90ecd6cf3dc1295f0
2023-11-21 10:43:10 -08:00
Sam Wilson
d670dd7746 maintenance: Remove commented-out code from install.php
These commented-out options have been pending for many years, and
there doesn't seem to be a plan to make them work. They can easily
be re-added if required.

Change-Id: I6aa9bfe4509062b0f204800fcee70ba767fbc517
2023-11-21 20:06:47 +08:00
Umherirrender
daa6526ce8 installer: Fix location of patch-pagelinks-target_id.sql for postgres
Bug: T351619
Follow-Up: I2ed692d7d0cdf756d29618363bec7fc761ff3df1
Change-Id: Ie2273c6803a83831b09f176057d6a9afccdfbdf2
2023-11-20 19:11:46 +01:00
jenkins-bot
54a15ffef4 Merge "maintenance: Batch update for _from_namespace in namespaceDupes.php" 2023-11-20 02:50:18 +00:00
jenkins-bot
ca9f8418d9 Merge "maintenance: Reduce delete attempts in namespaceDupes.php" 2023-11-20 02:38:46 +00:00
Umherirrender
7f3fcea319 maintenance: Batch update for rev_page in namespaceDupes.php
Limit the update to $wgUpdateRowsPerQuery rows.
The update now is over the primary key.

Bug: T350443
Change-Id: I4286ea35115aab331eaecf71fb3daf03708d3d38
2023-11-18 23:14:51 +01:00
Umherirrender
ee7aa4d7c7 maintenance: Batch update for _from_namespace in namespaceDupes.php
Limit the update to $wgUpdateRowsPerQuery rows.
The update now is over the primary key.

Also select only the rows with different _from_namespace and needs
change.
There is always a _backlinks_namespace index with the _from_namespace
field and all primary key fields to support this.

Bug: T350443
Change-Id: I503da35f71902c5ed57c5244cb3833fc4730ada3
2023-11-18 22:45:41 +01:00
Umherirrender
01a548ccb5 maintenance: Reduce delete attempts in namespaceDupes.php
Bug: T350443
Change-Id: I9b233d348e7b01358f123bd0d6128cb801ac8627
2023-11-17 22:48:46 +01:00
jenkins-bot
53e81e598b Merge "expireTemporaryAccounts: Only process temporary accounts" 2023-11-17 19:33:01 +00:00
Umherirrender
c31b09176d maintenance: Use QueryBuilder in namespaceDupes.php
Remove unused $db class property

Change-Id: I2f149485dcc4dd40b1d4fb0cf588b14bec4eecbb
2023-11-17 16:35:03 +01:00
jenkins-bot
7328f958cd Merge "build: Ignore param-taint and return-taint in Doxyfile" 2023-11-16 21:03:32 +00:00
Martin Urbanec
99650b86cd expireTemporaryAccounts: Only process temporary accounts
Bug: T351428
Change-Id: Ic170f4d901a520cf65b61b522f75998705eface6
2023-11-16 17:12:39 +01:00
Martin Urbanec
c9908da103 IP Masking: Expire temporary accounts in 1 year
Why:
Temporary accounts (introduced as part of IP Masking)
are supposed to expire 1 year after their registration.
Automatic account expiration can be done via a maintenance
script, which would be periodically executed via cron / systemd.

Make it possible for extensions to provide their own logic
for generating a list of temporary accounts to invalidate.
This is used in CentralAuth to base registration timestamp
on the global registration timestamp.

The default behavior is "temporary accounts do not expire",
given the feature requires a maintenance script to run
periodically, which will not be the case on third party
instances.

What:
* Add `expireAfterDays` to $wgAutoCreateTempUser, controlling
  how many days temporary accounts have.
* Add UserSelectQueryBuilder::whereRegisteredTimestamp(),
  filtering accounts based on user_registration.
* Add ExpireTemporaryAccounts maintenance script, which is
  @stable to extend.

Bug: T344695
Change-Id: If17bf84ee6620c8eb784b7d835682ad5e7afdfcc
2023-11-09 15:11:48 +01:00
Timo Tijhof
022605d32b build: Ignore param-taint and return-taint in Doxyfile
I've upgraded Doxygen to 1.9.8 in WMF CI (Ie025bd8a5e9), and among
the bug fixes was https://github.com/doxygen/doxygen/issues/9047,
which makes it possible to use tags that contain dashes in ALIASES.

Change-Id: Ida5fddb89b76445922a87904745eff0a1e299043
2023-11-08 14:54:24 +00:00
Amir Sarabadani
ad118dbb75 maintenance: Migrate $db->buildLike() to expression builder
Bug: T210206
Change-Id: Ie7bf3701fa9d51a43167ce7ec0c1f30bc090296b
2023-11-06 14:27:03 +01:00
jenkins-bot
69b6191820 Merge "Remove cleanupUsersWithNoId.php" 2023-11-03 22:56:56 +00:00
Tyler Cipriani
8b1532d4dd Disable namespaceDupes.php for now
namespaceDupes.php has lacks limits on delete and update queries. For
large updates and deletes this causes replication lag.

Disable this script until this issue is resolved.

Bug: T350443
Change-Id: I2b578535ff77f3080b4672ce098c24775f08a1e2
2023-11-02 18:32:06 -06:00
Tim Starling
cbe6714a99 Remove cleanupUsersWithNoId.php
All of the fields it's cleaning up have been deleted. The script cleans
up denormalized username fields which were deleted in the actor
migration.

It skips tables for which the name fields don't exist, which is all of
them.

Change-Id: I407a75c85cbd5ff6ab0d6d48d2bf07793e7c0c3e
2023-11-03 10:51:30 +11:00
jenkins-bot
63b013c5bf Merge "Migrate away from $db->makeList in favor of expression builder" 2023-11-02 17:02:11 +00:00
Amir Sarabadani
9009c4cbd7 Migrate away from $db->makeList in favor of expression builder
Bug: T210206
Change-Id: I803a6130fff5ce6faaaa5221443a436195b03c75
2023-11-02 16:40:48 +00:00
James D. Forrester
73874885ad Update references to renamed DatabaseMySQL class
Change-Id: Ic8d411152f5c031db6f30fc243af999f0ba5509e
2023-11-01 11:30:29 -04:00
Amir Sarabadani
2df0c99fe0 Migrate several subqueries to use SQB
Bug: T344971
Change-Id: I278a6efb7efefadd5db7b52490300811669372df
2023-10-31 15:54:55 +01:00
Umherirrender
6bc4944c20 maintenance: Also add imagelinks to cleanupInvalidDbKeys.php
To complete the list of tables

Change-Id: Ie26271b0424f76ddf3dccffa2021f73dcfe416d8
2023-10-29 15:05:17 +01:00
Bartosz Dziewoński
0454c52dde Improve uses of ->where( array_merge( … ) ) in query builders
Replace ->where( array_merge( a, b ) ) with ->where( a )->andWhere( b ).
It's shorter and I find it easier to read.

Change-Id: I94fef6219b5611659f7a09fd3a555aba001f5339
2023-10-26 19:44:02 +02:00
jenkins-bot
44404d8ee9 Merge "Fix use of buildComparison() in uppercaseTitlesForUnicodeTransition.php" 2023-10-24 17:10:31 +00:00
jenkins-bot
89032b4b1f Merge "Replace more single-value $db->buildComparison() with $db->expr()" 2023-10-24 16:43:47 +00:00
jenkins-bot
72c9e62ffe Merge "Replace single-value $db->buildComparison() with $db->expr()" 2023-10-24 16:27:22 +00:00
Bartosz Dziewoński
be2909da2a Fix use of buildComparison() in uppercaseTitlesForUnicodeTransition.php
$cont will be an empty array the first time, which is invalid.
Follow-up to 865002b57c.
Caught by Phan in I0d69ea6788304e8a073b7521a217882be7a92993.

Change-Id: I5c219e70e41c34869c03d6cd1ee6b7f1876a2a22
2023-10-24 16:22:49 +02:00
jenkins-bot
c985f2dff5 Merge "Replace deprecated Linker::formatComment in benchmarkCommentFormatter" 2023-10-24 01:35:04 +00:00
Bartosz Dziewoński
c9683b7092 Replace more single-value $db->buildComparison() with $db->expr()
A few more fairly simple cases that don't quite match the regexp in
I2cfc3070c2a08fc3888ad48a995f7d79198cc336 or required other tweaks.

Change-Id: I5438c777344e9ba07f3b62a452fce9ec63baa48a
2023-10-22 01:06:04 +02:00
Bartosz Dziewoński
978d739bc6 Replace single-value $db->buildComparison() with $db->expr()
Find:
->buildComparison\( ('..?'), \[(\s*)([^\],]+) => ([^\],]+)(\s*)\] \)

Replace with:
->expr($2$3, $1, $4$5)

Change-Id: I2cfc3070c2a08fc3888ad48a995f7d79198cc336
2023-10-22 01:05:47 +02:00
Bartosz Dziewoński
504ff04044 Remove incorrect copy-pasted documentation
Change-Id: Ib2a62720e25f99a89057430ed7387383c41012b0
2023-10-21 03:28:28 +00:00
Bartosz Dziewoński
695a489d5b Re-apply "Remove allowances for missing redirect rows"
This reverts commit c5f4ffd4e6,
re-applies commit b0fe2c4111.

WikiPage::getRedirectTarget() needs to still allow missing rows,
but for a different reason.

Bug: T348881
Change-Id: I6e1fd823fbe140819c28096d5adc41cd15bcc8c0
2023-10-18 23:50:01 +00:00
jenkins-bot
06e5f33507 Merge "Make ParsoidOutputAccess a wrapper over ParserOutputAccess" 2023-10-16 09:11:27 +00:00
jenkins-bot
d01fff9252 Merge "Use getServiceContainer() in maintenance" 2023-10-15 10:26:16 +00:00
James D. Forrester
fcf2dd1a98 maintenance: Return false rather than silently continue on corrupted legacy blobs
Bug: T340174
Change-Id: I5d6385b5c924985f47e199dee3ecef13905d6388
2023-10-13 19:11:37 -04:00
Subramanya Sastry
c8d0470f4b Make ParsoidOutputAccess a wrapper over ParserOutputAccess
* Updated ParserOutput to set Parsoid render ids that REST API
  functionality expects in ParserOutput objects.
* CacheThresholdTime functionality no longer exists since it was
  implemented in ParsoidOutputAccess and ParserOutputAccess doesn't
  support it. This is tracked in T346765.
* Enforce the constraint that uncacheable parses are only for fake or
  mutable revisions. Updated tests that violated this constraint to
  use 'getParseOutput' instead of calling the parse method directly.
* Had to make some changes in ParsoidParser around use of preferredVariant
  passed to Parsoid. I also left some TODO comments for future fixes.
  T267067 is also relevant here.

PARSOID-SPECIFIC OPTIONS:
* logLinterData: linter data is always logged by default -- removed
  support to disable it. Linter extension handles stale lints properly
  and it is better to let it handle it rather than add special cases
  to the API.
* offsetType: Moved this support to ParsoidHandler as a post-processing
  of byte-offset output. This eliminates the need to support this
  Parsoid-specific options in the ContentHandler hierarchies.
* body_only / wrapSections: Handled this in HtmlOutputRendererHelper
  as a post-processing of regular output by removing sections and
  returning the body content only. This does result in some useless
  section-wrapping work with Parsoid, but the simplification is probably
  worth it. If in the future, we support Parsoid-specific options in
  the ContentHandler hierarchy, we could re-introduce this. But, in any
  case, this "fragment" flavor options is likely to get moved out of
  core into the VisualEditor extension code.

DEPLOYMENT:
* This patch changes the cache key by setting the useParsoid option
  in ParserOptions. The parent patch handles this to ensure we don't
  encounter a cold cache on deploy.

TESTS:
* Updated tests and mocks to reflect new reality.
* Do we need any new tests?

Bug: T332931
Change-Id: Ic9b7cc0fcf365e772b7d080d76a065e3fd585f80
2023-10-13 15:03:03 -05:00
Bartosz Dziewoński
c82c20f1a7 Merge "Revert "Remove allowances for missing redirect rows"" 2023-10-13 16:10:49 +00:00
Bartosz Dziewoński
c5f4ffd4e6 Revert "Remove allowances for missing redirect rows"
This reverts commit b0fe2c4111.

Reason for revert: Causing test failures in the UserMerge extension.

Bug: T348881
Change-Id: I35e82df7a7f95150927dc6e4ad68588c3400b63f
2023-10-13 16:10:34 +00:00