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
Use str_starts_with, str_ends_with or string offset where appropriate.
This fixes a bug in MimeAnalyzer where the "UTF-16LE" header could not
be identified because of wrong constant. This is the exact type of bug
that the new functions can avoid.
Change-Id: I9f30881e7e895f011db29cf5dcbe43bc4f341062
This global variable was replaced by auto-discovery of parser test
files in extensions and is no longer needed (or used).
Change-Id: Ib616e60f36db32ffd8bc69c71a096f23c0a27910
This allows us to remove many suppressions for phan false positives.
Bug: T231636
Depends-On: I82a279e1f7b0fdefd3bb712e46c7d0665429d065
Change-Id: I5c251e9584a1ae9fb1577afcafb5001e0dcd41c7
All of these suppression prevent the detection of many common mistakes,
and could easily prevent things like T231488. Especially if there are
few issues of a given type, it's way better to suppress them inline,
instead of disabling them for the whole core.
This patch only touches the one with a lower count (although those
counts may be out of date).
Bug: T231636
Change-Id: Ica50297ec7c71a81ba2204f9763499da925067bd
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
Since MediaWiki 1.30 files under tests/parser/ automatically included
into the parser test run when using extension registry.
When migrate an extension to extension.json do not include the file when
it is autodiscovered.
Bug: T170037
Change-Id: I57f49610a47f0e62a1512e3769c6dbb0d845d6fb
The highest manifest version is not supported from the start of
extension.json
For extensions converted to this highest version the mininum core
version must be specified to avoid load problems in the extension.
Using 1.29.0 for manifest version 2 due to T149757 /
Id1071fc0647892438e5cd0e3ee621fbdaaa64014
Change-Id: Iea5ba589c70958db7500cf3587b5ebd738532026
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
substr returns false when the string is shorter than the initial
position, which makes array_key_exists freak out.
Change-Id: I38c2dd3a1ae5d700d66ff590dda4be67e4dc5514
Instead of forcing an object even for single-hook-listeners, allow
string values, too (one hook listener for one hook, only). Also:
use it as default for the conversion script, if only one listener
is added to a hook (which is usually the case). This leads into a
much cleaner output of the Hooks section of extension.json.
Bug: T133628
Change-Id: Ie9e54f0931c41706eb8d82d00256698992ec41cc
If an extension specifies a require section in its composer.json, which contains
some dependencies, we can assume that this extension needs to load the composer
autoloader.
The maintenance script convertExtensionToRegistration.php will now check if the
extension has such a composer.json and, if so, adds the load_composer_autoloader
property in extension.json, which will try to load the autoloader of composer
is it is present.
Also add a check for existence of a require section in ComposerJson library
(ComposerJson::getRequiredDependencies()).
Bug: T119766
Change-Id: Icdbc37abc44e642afee2aab4c0e9298d3471124d
Currently when converting from PHP to extension.json, 'namemsg' isn't
underneath 'name', it is halfway down instead.
Change-Id: I1be42a818bda6908643702cc5f7c959d2d2fdfba
Functions must not contain multiple empty lines in a row
(Squiz.WhiteSpace.SuperfluousWhitespace sniff).
Bug: T102774
Change-Id: Ib706e4fc34b95c0d7c887e54af0ea61227767d8f
Versioning the extension.json schema will allow us to make breaking changes
to the schema in a non-breaking manner.
Extensiosn and skins will set a 'manifest_version' value, stating which
version of the schema the file is written for. Processor::extractInfo() will
be passed the version number, and can switch behavior depending upon it.
For backwards-compatability, a version number of 1 is assumed if none is set.
The validateRegistrationFile.php script will emit a warning if this is the
case.
Bug: T99344
Change-Id: I2086a1465ceaeedd1ccc6804fda2c304ad16ffa0
Remember which settings we set to an empty array and then only skip
those settings.
The weird variable name "$__settings" is used to avoid any conflicts
similar to what eval.php does.
Bug: T98739
Change-Id: Iefbf8a98fd433cfbe0087aca6821d90c2786b0cb
$wgSpecialPageGroups is deprecated since 1.21
The code should be migrated to override SpecialPage::getGroupName before
adding an extension.json to the extension, instead of allowing setting
this over extension.json
Also added a warning to convertExtensionToRegistration.php for the no
longer supported global
Change-Id: Idccbe41b649de93548c5b0fca03145da716bcc65
Structurally, it's set up exactly the same as ResourceModules, so we can
re-use the same code.
Bug: T91566
Change-Id: I7cd1330edc3e97b4658c81aac67071a90ac61fb6
This allows for extensions to specify common arguments to ResourceLoader
module definitions by only specifying them once.
The only supported values are "localBasePath" (which is relative to the
current directory), "remoteSkinPath", and "remoteExtPath". If a module
is using a custom class or is already specifying paths, the default paths
will not be added.
Tests are included to cover existing functionality and newly added
functionality. The convertExtensionToRegistration.php script was also
extended to try and guess what the default paths should be.
Bug: T88786
Change-Id: I802461796e8d8584dacf3b0c811b5ba97a4a8f7f
It's an attribute now rather than a global, but we still want
to convert it.
This follows up 247ecab445.
Change-Id: Ibb61b1689e3e6b454d7bf2f300ab465e30ca774a
* Handle constructs like $wgResourceModules += array(...)
* Support $wgMessagesDirs['FooBar'] = array(...)
* Handle stripping paths where it is the current directory
* Use FormatJson::ALL_OK when writing the file
Bug: T86311
Change-Id: I9434f6634fd6e460a5c2f6dac95c9065da35a51a