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
Usually it doesn't make much of a difference, but potentially can
when the array is big. The extra conversion also makes the code more
complicated, I would argue.
Change-Id: I91b9e82ca801dd64523557d616462b7ea7edc7b0
This is, in theory, a loophole that can not only cause such code to
consume suprising amounts of memory and runtime. It can also create
suprising results. For example, an input like
-param="might contain a = char"
might result in a cut-off value.
Not so much of a problem in a maintenance script. But still good
practice, I find.
Change-Id: I14fb278e6fdb61d0c486ca7e23229851ea479408
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.
The old constant is an alias now.
Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
* This just purges an unused key as OldLocalFile::getCacheKey
simply returns false (rather than a key with "oldfile" in it)
Change-Id: Ic7dda9bf192803a75eaa9bd3bb5a145ad1409dd2
This was used in 2 special classes, the logger classes and spread
to a few other random classes.
Afaik this has no meaning. Is for something we don't use, and
goes against the meaning of '@section' in Doxygen, which we do
use.
In Doxygen output, all LICENSE references became links to
ProfilerXhprof (the one Doxygen encoutered first).
Bug: T72328
Change-Id: Icc7c443245c70bc0f549bee7d105eef5691c864d
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line
Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
This maintenance script enhances the prior purgeDeletedFiles script to
optionally also process create and modify events that may have left
stale information in front-end caches.
Changes from purgeDeletedFiles:
* `--starttime` & `--endtime` are now required
* `--type` allows selecting 'created' and/or 'modified' events in
addition to 'deleted' events.
* `--dry-run` to list affected files but perform no purges
* `--htcp-dest` option to restrict HTCP broadcast messages
Change-Id: I7181ea461ba9758747bff4fd70530d00dab492cc