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
This patch introduces a namespace declaration for the
MediaWiki\Json to FormatJson and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: I5e1311e4eb7a878a7db319b725ae262f40671c32
There is like a billion of these in our core codebase. I would love to
update them all. But I don't have the time, at least not to do them all
at once.
TL;DR: It's an improvement. :-)
Change-Id: I0a9c51bdcf0f261f971586bb8703f418324b0f98
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
Undeclared variables are a very common error type that we want to catch
as often as possible. To avoid needing to refactor a variety of global
level code (mostly in old-style maintenance scripts) this ignores
undeclared variables in global scope. This is still a good improvement
over what was happening previously.
Change-Id: I50b41d571724244552074b9408abbdf6160aca59
* Removed --langcode, which was for converting core messages files.
* Do not generate backward compatibility shims. MediaWiki 1.19 will
enter end-of-life status in May 2015.
* Print a special error message for shims, which is different from
the one that used to refer to --langcode.
* Removed extra newlines from error messages.
Change-Id: Ic8498fbdd7c2bd6e30ddbd96da85b2b8b23d706b
Recursively searches the DonationInterface extension for i18n files and
performs default conversion on the lot.
Usage:
php maintenance/generateJsonI18n.php \
--extension DonationInterface --supplementary
Change-Id: I8e61c3d0f34394c0d766cf9532df9ac221ce7405
Usage:
php maintenance/generateJsonI18n.php --extension WikiLove
Performs the default conversions in $IP/extensions/WikiLove/, replacing
the WikiLove.i18n.php file with a backwards-compatibility shim and porting
messages to the WikiLove/i18n/ directory.
This patch has the side-effect of making the second cmdline argument in
the ordinary usage optional. When omitted, we will make the default guess
as to $jsondir, that it should live in the same directory as the .i18n.php file.
Change-Id: I6246d2c4eb7327d6dcc503421b71ffdcaf01769c
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: I727deec35a712de0f0c676cc87dfa661f1ee965b
Because LocalisationCache::recache() includes PHP shims each time it is
called (e.g. for a different language), in such cases as automated testing,
the shims could end up registering handlers many times instead of only
once, leading to a rather significant, progressively worse slowdown.
Checking whether the shim has already been loaded, and if so, not
registering the handler again, avoids this performance problem.
I also made the shim compatible with PHP 5.2 (minimum PHP version for
MW 1.17 - 1.19) by avoiding closures and __DIR__, and I added a
--shim-only option to generateJsonI18n.php to allow regenerating
existing shims.
Bug: 63928
Change-Id: I3bb39e7d2bb094873061b3b2adf7066bf26c1b71
1) Some text editors add missing newline at the end of the file
automatically.
2) It's generally a nice thing to do to avoid messing up display
for example when cat'ing a file
Change-Id: Icf636721c4edcf4ae706c9a346fe36233928cae8
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat
Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f