Commit graph

10976 commits

Author SHA1 Message Date
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
jenkins-bot
ced29cfbe0 Merge "maintenance: Add missing documentation to class properties" 2024-09-13 18:15:35 +00:00
jenkins-bot
a27ade70ee Merge "Use const keyword for constant list of strings or ints" 2024-09-13 18:08:57 +00:00
Umherirrender
c8ec25a961 maintenance: Add missing documentation to class properties
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.

Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.

Change-Id: I7dec01892a987a87b1b79374a1c28f97d055e8fa
2024-09-13 19:29:24 +02:00
Dreamy Jazz
0747e4238f Mark overriding Maintenance::runChild as hard-deprecated
Why:
* Maintenance::runChild was renamed to ::createChild in
  af4117bbdd
* The ::runChild method was left as a deprecated alias and the
  stable to override annotation was removed.
* Following I96628f5e2bd847a1cf621b3f52015659cc1c170b, no WMF
  deployed code overrides the ::runChild method and
  therefore overriding the method can be marked as
  hard-deprecated.

What:
* Use MWDebug::detectDeprecatedOverride to mark overriding
  Maintenance::runChild as hard deprecated.

Depends-On: I96628f5e2bd847a1cf621b3f52015659cc1c170b
Bug: T374730
Change-Id: I2a3163c0853c3312cef5bee74771bed9eda74146
2024-09-13 16:58:13 +00:00
Dreamy Jazz
44cad41d03 Fix old autoblock unblock log entries with namespace in log_title
Why:
* The logging table on en.wikipedia.org contains an entry from
  2005 which is an unblock of an autoblock. However, the log_title
  contains the namespace, which makes the code that looks for
  logs which target an autoblock fail (because it checks for the
  first character being '#').
* Fixing the log_title to remove the 'User:' prefix from rows which
  are autoblocks (i.e. searching for log_titles which start with
  'User:#') should address the exceptions seen on Special:Log for
  these rows.
** The search can be limited to rows which have the 'unblock'
   log_action, as this has only been seen for this type of log.

What:
* Create fixAutoblockLogTitles.php which searches for the entries
  and then updates the log_title value to no longer include the
  'User:' prefix
** The queries to search are split, such that the expensive LIKE
   query is performed on batches of row IDs. If the LIKE query is
   applied directly to all rows in the table, the query takes 30s
   to run on WMF production.
* Add this maintenance script to update.php. It will be run once
  as the class extends LoggedUpdateMaintenance.
* Test the newly added maintenance script to ensure it works.

Bug: T373929
Change-Id: Ia62db56eda456bb764303b5f4b5a29be8f2d8fff
2024-09-13 12:18:32 +00:00
jenkins-bot
1ce05c306e Merge "Specify caller in DB queries" 2024-09-13 06:29:11 +00:00
Tim Starling
7b909408fc Move update-keys.sql to a PHP array
Improve maintainability of update-keys.sql by moving the list from an
SQL file to a PHP array in the same file as the updates it is disabling.

It was apparently an SQL file for the convenience of third parties
wishing to install MediaWiki by manually sourcing tables.sql. Support
this use case by adding an option to update.php which inserts the update
keys. Users should source tables-generated.sql and then run
update.php --initial

The array is the same for each DB type, but it's correct for it to have
the same scope as getCoreUpdateList(). Factoring out common parts of
getCoreUpdateList() and this new array is a separate project.

Bug: T167924
Change-Id: I404ee29aadcc2f3f24f78d1111090395129cd021
2024-09-13 12:02:07 +10:00
jenkins-bot
70fcffb795 Merge "Use $this->getServiceContainer() in maintenance" 2024-09-12 20:31:11 +00:00
Pppery
d35741b403 NamespaceDupes: check if page exists from primary database
Bug: T374631
Change-Id: Ia3480d40bd7696726cf05cec3d873d2cb4e2e255
2024-09-12 11:39:39 -04:00
Umherirrender
465777f188 Use const keyword for constant list of strings or ints
Also changed visiblity of some to private

Change-Id: I113b040321d27c84fe9b807c162736909e96fb20
2024-09-11 23:16:24 +02:00
jenkins-bot
41e428a0a5 Merge "Fix broken deleteSelfExternals.php and test it" 2024-09-11 18:57:37 +00:00
jenkins-bot
2f38506886 Merge "Test grep.php" 2024-09-11 18:36:23 +00:00
jenkins-bot
3c9691ea24 Merge "Start on tests for userOptions.php" 2024-09-11 18:30:43 +00:00
Dreamy Jazz
4a6de09299 Fix broken deleteSelfExternals.php and test it
Why:
* The deleteSelfExternals.php maintenance script is broken on
  my local wiki as the SQL generated by the script errors out
  when run on MariaDB.
* This script should be fixed, updated to use the query builders,
  and tested to ensure that any future breakages do not go
  unnoticed.

What:
* Fix the deleteSelfExternals.php script to use a DELETE query
  that works, by generating it using the query builder.
* Create DeleteSelfExternalsTest to test that the script now
  works.

Bug: T371167
Change-Id: Id423fa5c1bfe666f57a38e733334342ac1ad2cea
2024-09-11 18:23:40 +00:00
Bartosz Dziewoński
ecb8b0d689 Specify caller in DB queries
Found warnings about this in WMF production logs.

Change-Id: I3ba973c320d672604c0c0ffa1c229a32231261b9
2024-09-11 15:20:47 +02:00
jenkins-bot
15bfd2e9f8 Merge "Remove ParserOutput::getText() calls from core (runOutputPipeline)" 2024-09-06 19:39:11 +00:00
jenkins-bot
36573588b0 Merge "Hard deprecating wfGetServerUrl" 2024-09-06 19:09:50 +00:00
Isabelle Hurbain-Palatin
ce2bccc0a8 Remove ParserOutput::getText() calls from core (runOutputPipeline)
This is the fourth patch of a series of patches to remove
ParserOutput::getText() calls from core. This series of patches should
be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e.

Here we replace calls to getText where a ContentRenderer is available
close by by temporary ParserOutput::runOutputPipeline that will
eventually be replaced by a call to (probably) ContentRenderer
 (T371004). Doing this work in stages allows us to separate the work of
"bring ParserOptions to the call site" from the work of "bringing
ContentRenderer(ish) to the call site", since both need to be done for
to make ParserOutput a value object (T293512).

Change-Id: Ib4f9357293dc230df6e0ca2379a1e2a4cc1b91b7
Bug: T293512
2024-09-06 19:07:49 +00:00