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
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
Maintenance class provides a method for getting a fresh reference
of the MW services container instance. Let's make use of these in
maintenance scripts now that we have it.
NOTE: There are still some static methods like in refreshLinks.php
that makes use of services that we can't use this method for now.
Change-Id: Idba744057577896fc97c9ecf4724db27542bf01c
* Avoid a possible one-row gap between batches: when lt_id is equal to
the maximum ID for the current batch, it is not included in the next
batch, so should be included in the current batch.
* Do not include lt_id values greater than $maxLtId in the final batch.
* Fix a bug that, if any unused linktarget row is found, would result in
deletion of ALL ROWS in the table (not just the unused ones).
Follows up 62a01b7e8c.
Change-Id: Iba5643a13068c57fae2b1791f5c90ef9456aa78c
Otherwise it fatals when it tries to select with empty array.
Wikimedia\Rdbms\Platform\SQLPlatform::makeList: empty input for field lt_id
Follow up to I59fd88368e8
Change-Id: Ifc989b6527777a73bda9922006ea7cea2c4c0331