This does not include use of MediaWiki\Maintenance\Maintenance,
assuming the maintenance scripts going into the same namespace
Change-Id: I488f95b537ce86eb5e463be7bce3653610dd13d9
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
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 user 'Maintenance script' is often used to perform various
automated tasks. Providing it everywhere as a string literal is
error-prone, and errors can be somewhat disruptive (e.g. with
User::newSystemUser with steal=true it can erase the credentials
of a legitimate account). Provide a constant instead.
Also replace existing uses for consistency.
Change-Id: I685a5bfe56bbf1a47f35072f7f7c8be320ee27db
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
When importing a file whose name contains a #, the script would call
e.g. Title::newFromText( '#foo' ), which succeeds (because titles
are allowed to contain fragments) but causes problems when trying
to create the revision.
Also avoid fatals on actual invalid titles.
Bug: T142675
Change-Id: I6b4c8fd8dd09db14c0704c74137e112b292c964a
The Windows command line doesn't automatically expand wildcards, unlike
Unix shells. So the script tried to run function calls like
file_get_contents( '*.txt' ), which do not work. This patch uses glob()
to simulate the behaviour of the Unix shell.
This was reported at https://www.mediawiki.org/wiki/Topic:T7hf8bz8u2p4ryol
Change-Id: I002344a19cb08cc8ac8ee75214339b2379b04dbe
- Add --bot to mark edits as bot edits when --rc is specified
- Add --overwrite to overwrite existing pages with changes.
This respects the --use-timestamp option by only overwriting if
the file is newer than the latest revision on the destination page.
- Add --prefix for specifying a prefix
- Add --rc to add an edit entry to Special:RecentChanges
This is a GCI task.
Change-Id: I5acf829409853e2b311ae6c1c75a009fef91ceeb
importTextFiles.php can be used to import pages from text files
containing wikitext.
Also, added $userObj to WikiRevision so that it can accept a User
object instead of just a username.
This is a GCI task.
Change-Id: I20eaf2005bdd3d041f55d8c0b108f001c064d638