Commit graph

10 commits

Author SHA1 Message Date
Dreamy Jazz
e7393b3cc7 Exclude boilerplate maintenance code from code coverage reports
Why:
* Maintenance scripts in core have bolierplate code that is
  added before and after the class to allow directly running
  the maintenance script.
* Running the maintenance script directly has been deprecated
  since 1.40, so this boilerplate code is only to support a now
  deprecated method of running maintenance scripts.
* This code cannot also be marked as covered, due to PHPUnit
  not recognising code coverage for files.
* Therefore, it is best to ignore this boilerplate code in code
  coverage reports as it cannot be marked as covered and also
  is for deprecated code.

What:
* Wrap the boilerplate code (requiring Maintenance.php and then
  later defining the maintenance script class and running if the
  maintenance script was called directly) with @codeCoverageIgnore
  comments.
* Some files use a different boilerplate code, however, these
  should also be marked as ignored for coverage for the same
  reason that coverage is not properly reported for files.

Bug: T371167
Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
2024-08-27 13:22:29 +01:00
James D. Forrester
1d0b7ae1e2 Namespace User under \MediaWiki\User
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
2023-09-19 19:18:16 +00:00
Amir Sarabadani
b525884e11 maintenance: Use $this->waitForReplication()
This adds reconfiguring db pools in case a replica gets depooled

Bug: T298485
Change-Id: Id052ce8ed45c51e51b071778858d27b48605bf93
2022-10-24 21:11:53 +02:00
Umherirrender
49ad716948 Use User::isRegistered for readability instead of ::getId falsy check
Change-Id: I42aab149559e3e899cde6c77af76c66936ed0ef0
2022-04-29 21:15:57 +02:00
Reedy
12e31c7d02 Fix class name of InvalidateUserSessions
Change-Id: I0c0f5c94a7ee0aa3f0aeb8b7f84857022810f17a
2021-08-23 19:03:39 +01:00
Umherirrender
ad776c7d5f Use ::class to resolve class names in maintenance scripts
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
2018-01-23 17:40:16 +00:00
Bryan Davis
9e34eeff23 Maintenance: add fatalError() method
Deprecate the second argument to Maintenance::error() in favor of a new
Maintenance::fatalError() method. This is intended to make it easier to
review flow control in maintenance scripts.

Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
2017-11-21 21:34:16 -07:00
Max Semenik
dac20d0ffa Introduce Maintenance::getBatchSize()
Just to isolate the internals. Fix most of usages in the core.

Change-Id: I8b3e9ca1f42b7c49ee57f17b88ca2fc7b404f342
2017-11-05 13:26:12 -08:00
Gergő Tisza
fa186b2e64 Handle session reset errors in invalidateSessionsForUser.php
Also, do not skip session reset if the user does not exist locally.

Change-Id: I5a55e4a6f2d296576ee76e212ed379225251e128
2016-06-18 11:01:20 +00:00
Gergő Tisza
c2fb1b900b Add invalidateUserSessions.php maintenance script
Similar to resetUserTokens.php but uses AuthManager and takes a
list of users (a script for invalidating all users would be
mostly pointless with $wgAuthenticationTokenVersion).

resetUserTokens.php is deprecated, but kept around - mainly in case
we want to transform it into a fast token reset algorithm much like
I6b6e75db2a.

Change-Id: I81450c44a7af26393db7fc61fd5c05f13a13ac3f
2016-06-16 12:57:18 +00:00