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
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
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
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
Found via (?<!IDBAccessObject)::READ_
We are planning to deprecate and remove implementing IDBAccessObject
interface just to use the constants.
Bug: T354194
Change-Id: I89d442fa493b8e5332ce118e5bf13f13b8dd3477
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
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
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
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
Limit the update to $wgUpdateRowsPerQuery rows.
The update now is over the primary key.
Bug: T350443
Change-Id: I4286ea35115aab331eaecf71fb3daf03708d3d38
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
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
After the other changes in T346290 these fields can never be null.
The only place that needs to handle null values is the migration
script fixInconsistentRedirects.php.
Bug: T346290
Change-Id: I0235c4be93b203f369b29522b54c0110ee8d61e9
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
buildComparison() already quotes arguments given to it, so doing it
twice makes the query return wrong results.
Bug: T333166
Follows-Up: Ic368a87fb5ce4c13608b03206cd68518ec9732d4
Change-Id: I008b74623e6e5d7f7c6b5b5ceb690c2aa7e5b6cb
Builds a condition comparing multiple values, for use with indexes
that cover multiple fields, common when e.g. paging through results
or doing batch operations. Can also be to generate a simple comparison
without writing raw SQL (see T210206).
Update a few manually constructed conditions to use this method.
There are more maintenance scripts and API classes that use the
same patterns, but this is a start.
As you can see by the code I'm replacing, there are many ways to do
this. I picked the one used by maintenance/TableCleanup.php, since
I found it the easiest to understand.
Change-Id: Ic368a87fb5ce4c13608b03206cd68518ec9732d4
Make phan stricter about conditional variable declaration
Remaining false positive issues are suppressed.
The suppression and the setting change can only be done together
Bug: T259172
Change-Id: I1f200ac37df7448453688bf464a8250c97313e5d
Make phan stricter about scalar types by setting scalar_implicit_cast to
false (the default in mediawiki-phan-config)
Bug: T242536
Bug: T301991
Change-Id: Ia2fe30b17804186571722e728578121c8b75d455
Apply prefix and suffix to invalid titles just like it's applied
to conflicting titles. (Typically this will be needed when the
Foo namespace is created and there is a Foo: article already.)
Also remove a broken for loop. Presumably the intent was to
repeatedly add prefix/suffix on conflict, but actually it would
just get into an infinite loop. The behavior doesn't seem that
useful anyway.
Bug: T293407
Change-Id: Ieef6698b461e7db003dc326e5cd82accd2909540
Deconstructing non-sparse, numerically indexed arrays directly in
foreach (a.k.a. using the list() syntax in foreach) is possible since
PHP 5.5.
The possibility to use string array keys as well as non-sequential
numeric keys in array deconstruction was added in PHP 7.1.
Change-Id: I56a48552a45f61cedc291b306cad8548fc70d485