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
Currently, it only updates if the _target_id column is NULL which is not
the case for pagelinks (the default is zero) making this script not very
cooperative when I run it on pagelinks
Bug: T345733
Change-Id: I60d38fac96825ed479fd0c41fc35e70e5a6367df
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
The day has gone. Still keeping the code as the schema changes are not
done in production but the data migration has been finished.
Bug: T299417
Change-Id: I906e069a63d1dae14924c72318b22b16244371d6
On a live site configured for WRITE_NEW, no new templatelinks rows in
which tl_target_id IS NULL should be added. Assuming this is the case,
the conditions on PK fields (tl_from, tl_namespace, tl_title) should
suffice to limit the number of affected rows, since the range of page
IDs is limited and only one distinct target ID is filled at a time.
This avoids a needless "Updated 0 rows" query for every link target
within a batch.
Change-Id: I8af72ca8fe4c68da1603670d065a2b51ab96b79d
See, for example, MariaDB documentation:
https://mariadb.com/kb/en/between-and/
In part because of this, the code was including the first two page IDs
of an outer batch in the previous outer batch as well. Fortunately, this
was the case as opposed to failing to update those rows. In any case,
this commit corrects the calculation of $highPageId so the batching
works as expected.
Change-Id: Icb5eb5797d7a6cf992895224e091aad1da499724
* Changed the message printed if the update is skipped to start with an
ellipsis for consistency with other such messages.
* Replaced "migrate templatelinks" with wording that includes the actual
name of the script to avoid any potential confusion over the absence
of a script named "migrateTemplatelinks.php".
* Added "linktarget" to the error message printed if the linktarget
table is missing. Otherwise, the error message would be easily
misunderstood as saying the templatelinks table is missing.
* In migrateLinksTable.php, changed the wording of messages printed when
the script starts and finishes for better grammatical correctness.
Change-Id: Id11a212d667cc2b5064eb0128f2db1888fb7324d
- schema change to allow tl_namespace and tl_title being empty
This is done by removing them from primary key. They don't need to be
nullable as they have default value.
- Make sure with WRITE_NEW, updater avoids writing to the old columns
Bug: T306674
Change-Id: I2b8a29043e952060e7a79b6a7a3d647d48cd16fb
Currently, this errors out with
Error 1054: Unknown column 'TemplateLinksSchemaMigrationStage' in 'field list'
Bug: T299424
Change-Id: I3e86389ed1230b81267b8ad642dc22d658f7e999