Commit graph

10994 commits

Author SHA1 Message Date
Redjard
88c6cfbc8d Fix attachLatest --regenerate-all creating invalid SQL command
Change-Id: Iabb55be7b7c55dad072b53147570ae71ed382081
(cherry picked from commit 6f708bf0746fb43fbce8d32368bdb0519a64ed9b)
2025-07-23 11:06:39 +00:00
Tim Starling
30c2ad5fae uppercaseTitlesForUnicodeTransition: Add missing return
When MovePage::move() returns an error, doMove() should return false
instead of carrying on with move log adjustment.

Bug: T394556
Change-Id: I0864bd491d59fff42a062d7e5db957e46852761a
2025-07-02 00:34:22 +01:00
Reedy
82d3f6ac64 composer.json: Updated nikic/php-parser from ^4.10.2 to ^5.3.1
Bug: T379508
Change-Id: Ia693d5e3424d925172cd2e4b7cb501a031822f3b
(cherry picked from commit beed3ed1741db223e9e48c159214059d9c7eb439)
2025-06-18 10:54:38 +01:00
James D. Forrester
ac8a5b0b59 Drop PHP 7.4/8.0 support from master (forward-port from MW 1.42)
This patch was applied to release branches for MW 1.42 in April 2024, and
since ported to MW 1.43 and then MW 1.44 as well. This one-of-a-kind hot
patch will finally discontinue once this lands in the master branch as
part of MW 1.45+ releases.

A small handful of phan fixes make this pass so it can land; the rest
(including fixes rather than suppressions of events here) will happen in
later patches.

Bug: T328921
Bug: T359868
Change-Id: Ica2c11a6243795437ec652923e42ef3bd74a5fd8
2025-06-18 10:53:22 +01:00
Pppery
a43f368b65 Update RfC links to bypass redirect
Per https://meta.wikimedia.org/wiki/Talk:Interwiki_map/Archives/2024#RFC

Bug: T71997
Bug: T382963
Change-Id: I2b6b63f7809e5801c78de370c828bbca5fe95e64
2025-06-03 16:37:04 -04:00
Tim Starling
66c2681f7c In .htaccess deny files, use "Satisfy All"
These .htaccess files are intended to prohibit all web access. But if
the user sets "Satisfy Any" on a parent directory, in conjunction with
any permissive require directive like "Require all granted", access will
be allowed despite "Require all denied" in .htaccess.

So, override Satisfy so that the "Require all denied" will reliably take
effect.

Note that "Satisfy All" is the default. This only affects non-default
installations.

Change-Id: Ia5862fb69e439b7ea2ed7af011e1ebf8f1b1f6d6
(cherry picked from commit a50d2e69f8ce9e5720b05615d04c35cc9008b6ae)
2025-04-04 13:17:15 +00:00
BlankEclair
4990c51d62 ImportImages: Exit with non-zero code if import fails
When scripting, folks generally check the exit code of a program to be
zero if it is successful, and non-zero if it isn't. Since importImages
can be used in third-party scripts to automate wiki imports, it is
paramount that import failures are detected.

However, since it doesn't exit with a failure code (i.e. a non-zero
exit code) when a file fails to import or when there are no files
found, it is much more difficult to detect import failures.

Therefore, we exit with a non-zero return code to make import failures
much more easier to detect for scripts.

Bug: T388296
Change-Id: I5d9ede123355d63267793133287253a86faecda5
(cherry picked from commit 5a7c5491775ebf97f60fc7067d3d41c609358534)
2025-03-08 14:02:30 +00:00
Bryan Davis
be3c297852 initEditCount: Join from user to actor to revision
Correct the join conditions used to find the current edit count for
a batch of users. Follows up b98f33c where the incorrect join order and
conditions were introduced as part of migration to QueryBuilder syntax.

Change-Id: I1841bb074b0f2be31e60a3cce3d62eb1b5999ad0
(cherry picked from commit 834891e01afa19cc1ecd973c04a453a9abb2d484)
2025-03-03 15:32:50 +00:00
Umherirrender
87238af0a0 Revert "maintenance: Use DatabaseSqlite for type-hinting instead of DBConnRef"
This reverts commit 4563e41f20.

Reason for revert: The expected DatabaseSqlite is not directly used here, it is still DBConnRef and the patch does not work as is.

Bug: T386891
Change-Id: I83b1e299b698c004dcacb9aa90901dfe28097403
(cherry picked from commit 7fdc51ed4d27ba6211215c6198b7e448de799cde)
2025-02-20 20:35:40 +00:00
Máté Szabó
1761b1b760 dumps: Use proc_close() to close proc_open() subprocess
Why:

- TextPassDumper may spawn PHP subprocesses via proc_open() when invoked
  with --spawn.
- The script uses pclose() to try and close these, which is incorrect,
  because the resource returned by proc_open() should be closed via
  proc_close().[1]
- This causes a TypeError on PHP 8.1 and newer.

What:

- Use proc_close() to close the resource instead of pclose().

Test Plan:
- Run `php maintenance/dumpBackup.php  --current --stub | php maintenance/dumpTextPass.php --spawn`
  on a local test wiki using PHP 8.1 or newer. It should succeed.

[1] https://www.php.net/manual/en/function.proc-open.php

Bug: T382484
Change-Id: I66cd733cdbc1b8bc1470c14851a0700401c36d1e
(cherry picked from commit 8b9c3ab08eddc86032166f5b9dc208e51c2aaebb)
2025-01-18 06:03:18 +00:00
Timo Tijhof
e0f6f8f527 objectcache: Move RedisConnRef.php to /libs/objectcache/
Change-Id: I4c6a349afcc4039bec27413af9511639f8c0c4b0
(cherry picked from commit 72338de32b249a7cff0b758746c0896fd649e53b)
2024-11-07 08:40:54 +00:00
Derk-Jan Hartman
b00f7237ee Searchindex primary key, title length and utf8mb4
- Make si_page primary key
- Allow si_title to be larger
- Switch from utf8 to utf8mb4
- Remove default of empty string for titles

Sqlite is not migrated, as it has it's own overrides
Postgres is migrated, but is not in actual use

This is mostly from I273e3a7715abf97d2889904642c7c375e76de4f6

Bug: T249976
Bug: T231827
Change-Id: I12adff3e6ca6a9986ff207bef16272195c3a6a48
(cherry picked from commit a2ba7ee14d6b38a5e89bcc63c3bd0ca8b5107702)
2024-11-02 11:14:37 +00:00
Umherirrender
06947613d7 maintenance: Use namespaced classes
This does not include use of MediaWiki\Maintenance\Maintenance,
assuming the maintenance scripts going into the same namespace

Change-Id: I488f95b537ce86eb5e463be7bce3653610dd13d9
2024-10-21 19:08:08 +02:00
Sergio Gimeno
af7ac12b6a userOptions: make --old a multi option
Allow to target a list of old values for a given user
option.

Bug: T375753
Change-Id: Ia12bb68696ba62418e918955f342b43e24f48111
2024-10-17 11:59:12 +02:00
jenkins-bot
abc8da60be Merge "Use explicit nullable type on parameter arguments" 2024-10-16 23:10:14 +00:00
Umherirrender
e662614f95 Use explicit nullable type on parameter arguments
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead

Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a

Break one long line in SpecialPage.php

Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
2024-10-16 20:58:33 +02:00
James D. Forrester
e7db78e8d6 Replace uses of deprecated ChangeTags static methods
Bug: T360664
Change-Id: I3363a225e54bb2cae01ba066d432a8b7b21933d2
2024-10-16 13:30:12 -04:00
Reedy
499dbfb4cb maintenance: Use more of namespaced Maintenance class
Change-Id: I53f2e32c73c92cc3a0deee48ebe6d13329a7a0cf
2024-10-16 01:09:19 +00:00
jenkins-bot
23ec5ff94e Merge "Add namespace to maintenance/includes classes" 2024-10-15 22:50:33 +00:00
jenkins-bot
346bf0c8ee Merge "Test findDeprecated.php" 2024-10-15 17:41:25 +00:00
jenkins-bot
7a1bc97c09 Merge "Mark overriding Maintenance::runChild as hard-deprecated" 2024-10-15 17:41:15 +00:00
Dreamy Jazz
e2b6281d6d Test findDeprecated.php
Why:
* Maintenance scripts in core have low test coverage
* This can cause issues such as the findDeprecated.php maintenance
  script not working, as described in T374832
* Testing the broken script after fixing it will avoid the script
  breaking again.

What:
* Fix the findDeprecated.php maintenance script to actually
  show when code is hard-deprecated.
* Modify the script to allow mocking of the MediaWiki install
  path in PHPUnit tests
* Create FindDeprecatedTest which tests that the script produces
  an expected output, without being specific about how the
  code finds the methods (to allow the method to be changed
  as discussed in T243403)
** To do this, create a folder in the data folder for the PHPUnit
   tests that has a mock file structure allowing the test to
   use a fixed list of soft and hard deprecated methods.

Bug: T374832
Bug: T371167
Change-Id: Ic4933cef95ef1af7fa3939625ac1747106c71230
2024-10-15 17:08:23 +00:00
jenkins-bot
ae3afe014b Merge "Remove meaningless @var documentation from constants" 2024-10-09 22:03:23 +00:00
James D. Forrester
9f02d18eac Add namespace to maintenance/includes classes
Also a few other fixes of PHP class aliases spotted by phan.

Bug: T353458
Change-Id: Ie79d65722c47c24f8f20f1293355cfd3c2e8c2ad
2024-10-09 11:02:09 -04:00
thiemowmde
b1c9ec74fa Remove meaningless @var documentation from constants
A constant is not a variable. The type is hard-coded via the value
and can never change. While the extra @var probably doesn't hurt much,
it's redundant and error-prone and can't provide any additional
information.

Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
2024-10-09 09:33:12 +02:00
Dreamy Jazz
5a5d4a8aa1 Expand tests for rename user maintenance scripts
Why:
* Maintenance scripts in core are mostly untested
* Increasing this test coverage, especially for more critical
  scripts, will help avoid bugs and regressions.

What:
* Add tests for renameUsersMatchingPattern.php
* Expand tests for renameUser.php
* Add TestSelectQueryBuilder::assertFieldValues, which is used
  to assert against the result of ::fetchFieldValues.

Bug: T371167
Change-Id: I0470c53df7f31ae4891c33aeb5ba6e308bdcdac6
2024-10-08 21:51:59 +01:00
Aaron Schulz
cc204ad455 Remove non-functional --server parameter from BackupDumper
Change-Id: I9bd59f6d625b73d087b3ecb3289d7e50b29d22c0
2024-10-07 15:19:07 -07:00
Yiannis Giannelos
fec9daae4e Use statslib for metrics emitted by HtmlOutputRendererHelper
Bug: T359476
Change-Id: If8bc5a7f7383dcb67dadf1f4c02d1b69d7c8fa53
2024-10-04 14:52:30 -04:00
James D. Forrester
91a37f53b4 Switch over a bunch of class_alias uses to actuals
Change-Id: Id175a83e71cc910eaee5d5890a9106872a3ca3b8
2024-10-03 17:09:36 +00:00
James D. Forrester
9203493606 Add namespace to remaining parts of Wikimedia\FileBackend
Bug: T353458
Change-Id: I49c843c9d8f6459c0fbf774afeea7a82fa564b59
2024-10-03 16:21:22 +00:00
jenkins-bot
4627fe60af Merge "Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\Stats" 2024-10-03 14:16:24 +00:00
jenkins-bot
831a027afd Merge "Add namespace to Wikimedia\Redis libs" 2024-10-03 13:59:08 +00:00
Tacsipacsi
16f60562fe Remove manpage generation from Makefile
Manpage generation has been removed half a decade ago in
853838a322.

Bug: T232104
Change-Id: I6f6930663a66c6e86a7007d76d8af68a5dcd2421
2024-09-29 11:06:48 +02:00
James D. Forrester
cc28acc455 Add namespace to remaining parts of Wikimedia\Mime and Wikimedia\Stats
Bug: T353458
Change-Id: If0137003ab625017d322d57870448a02569668c3
2024-09-27 16:19:10 -04:00
James D. Forrester
2144fef6d1 Add namespace to Wikimedia\Redis libs
Bug: T353458
Change-Id: I7a874e1ee1d41a75e34b8a6b6f4d065b5b812c43
2024-09-27 16:19:10 -04:00
James D. Forrester
9e5c1e8ac7 Add namespace to IDBAccessObject and DBAccessObjectUtils
Bug: T353458
Change-Id: I23cf7991f8792d4d000d1780463d8ce76dc0aee0
2024-09-27 16:19:10 -04:00
jenkins-bot
60a8d322c5 Merge "externalstore: cleanup ExternalStoreDB::getTable() and fix callers" 2024-09-24 21:23:50 +00:00
jenkins-bot
18eb434cf5 Merge "Pass function name to IDatabase functions" 2024-09-20 01:25:26 +00:00
Umherirrender
fdac97eaf3 Pass function name to IDatabase functions
Change-Id: Ie2a1e5052e5b61bbb5b89905de942f47d3f1413d
2024-09-19 21:02:52 +02:00
Umherirrender
58e26c3ef6 Make $fname mandatory on private functions
For a private function the $fname does not need to be optional,
it should be easy to pass it always.

Change-Id: Ifcddcd2479ae6f8bbf68210441c61ee7a45e1489
2024-09-19 20:09:20 +02:00
Aaron Schulz
be8eabd684 externalstore: cleanup ExternalStoreDB::getTable() and fix callers
Remove unused $db parameter and make the $cluster required. Update
the checkStorage.php callers to provide the cluster.

Use the getTable() method in trackBlobs.php to avoid duplication.

Mark this method as @internal to the class and /storage scripts.

Change-Id: I888040a536a60e22e780900a59e4c34b6c468cdf
2024-09-18 15:21:35 -07:00
jenkins-bot
03e77b1ff2 Merge "language: Use const keyword for mapping of strings" 2024-09-17 22:58:41 +00:00
Umherirrender
f1804bd6d4 language: Use const keyword for mapping of strings
The variables on the converter are not usable outside of the class,
so making the public ones also private.

Change-Id: I6087dcdac761916359009548beb5210671a32ee5
2024-09-17 18:24:55 +00:00
jenkins-bot
5253dd5bf3 Merge "Test exportSites.php and importSites.php" 2024-09-16 22:56:25 +00:00
jenkins-bot
634373a3cf Merge "REST: add restbase compat mode for some endpoints" 2024-09-16 19:21:57 +00:00
jenkins-bot
c7af12dc4f Merge "NamespaceDupes: check if page exists from primary database" 2024-09-16 14:05:10 +00:00
Dreamy Jazz
d814e25a81 Test exportSites.php and importSites.php
Why:
* Maintenance scripts in core have low test coverage.
* Testing scripts which are not overly complex should create
  less complex tests that easily raise test coverage.

What:
* Create a test for both exportSites.php and importSites.php which
  checks that the XML file produced by exportSites.php can be
  parsed and produces the same sites table config as was exported.

Bug: T371167
Change-Id: I3eb1b86803ee2413e624f9ffe699a60161103758
2024-09-16 11:51:34 +00:00
jenkins-bot
3925b14ffb Merge "Move update-keys.sql to a PHP array" 2024-09-16 10:27:53 +00:00
daniel
602f0ab595 REST: add restbase compat mode for some endpoints
In order to replace the /api/rest_v1/page/title/{title} endpoints, we
need to have something in MediaWiki that generates a compatible
responser. The v1/page/{title}/bare and v1/revision/{id}/bare endpoints
are functionally equivalent, so the easiest approach seemed to be to
add a compatibility mode to them. The compatibility mode is triggered
using the x-restbase-compat header, which can be set via the gateway
when routing the request from /api/rest_v1/page/title/.

Bug: T374136
Change-Id: I4af7ff5325660ae30faebb24753b9dc1c3acb2b3
2024-09-15 16:41:21 -05:00
jenkins-bot
dbb28b2699 Merge "Fix old autoblock unblock log entries with namespace in log_title" 2024-09-13 18:38:31 +00:00