The way this test is set up means the $this->params property is not
initialized. It is only initialized when execute() is, well, executed.
Since there is not really a guarantee this will always happen before
the failing method is called, I figured it's better to add this cheap
safety check in the production code.
Taggign with T233012 because I believe this extension is a gated one
for many other codebases.
Bug: T233012
Change-Id: Ie0060125cf4646d80f8c88eedd01551f66e3fb89
composer:
* mediawiki/mediawiki-codesniffer: 28.0.0 → 29.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate
npm:
* eslint-config-wikimedia: 0.12.0 → 0.15.0
* grunt-eslint: 21.0.0 → 22.0.0
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.
* Removing manual reportUnusedDisableDirectives for eslint.
Change-Id: I351f0a333fd5f06e47f0748aa25cb3fff63cc67f
I argue that the code fixing unclosed HTML tags is – even if optional –
an integral part of the code that potentially breaks these HTML tags in
the first place. Notice how much code disappears in the ApiQueryExtracts
class.
Additionally, the new approach uses an interface instead of a static
function call that is impossible to mock and hard to test.
Change-Id: Ic1a65995f4dba11d060a8738d642905cbfc79271
Note how only two files mentioned the license before. For consistency
it should be either all or none. Both solutions would be possible. Even
*not* mentioning the license anywhere in these files would be fine from
a legal perspective, as long as the relevant file COPYING is still
there in the root folder of this extension.
The overly long "deed" text does not serve much of a purpose. It's not a
complete, legally relevant license text. It's hard to read as the fact
this is "GPL2+" is surprisingly hard to find. The @license tag solves
these problems, and is recognized by documentation generators.
Change-Id: I7844be0c5f4f3d7562156cd9f34fe466552a9c9d
This is a straightforward baseline patch that does nothing but moving
existing code around, without touching it. I'm not even trying to
remove the "static" keyword. The actual refactoring will be done in
the next patch. I hope with this the changes I do in the refactoring
become more visible and much easier to review.
Change-Id: Idba859ec0c24f3622ea8fb8d7a9b11843d1e3827
This gets rid of code that is reported as being unused, even if it is
used.
This also simplifies the regular expression a little bit. The .
automatically ends at the end of the line when the mode /s is *not* set,
which it isn't. The /m mode is not needed then because there is no ^ or
$ any more in the regular expression.
Note this code is sufficentily covered by a test (one I wrote just a
few days ago).
Change-Id: I8eb57e308bb2b281e0e72499b4d46f93a4dfa5f4
This patch fixes two styls issues I could not separate:
* Hook handler functions do not need to return true. This is the default
anyway, and meaningless.
* Counting is possibly expensive and not needed when all we need to know
is if an array is empty or not.
Change-Id: I460776c981638806a606d9bf88fc8579d6da8c0e
Also renames $action to $name in APIQueryExtracts.php, because trying to
document the parameter revealed that "action" doesn't match the use of
the parameter.
Bug: T170580
Change-Id: I1b7f3f0e17b118ea9bcfd28c69321aa692aad4e3
Changes:
- ApiBase::setWarning() is deprecated, use addWarning() instead
- ParserCache::singleton() is deprecated, use MediaWikiServices instead
- Exception import is not used, drop it
- added MediaWiki 1.29 as a requirement
Bug: T166714
Change-Id: Ib81e5acbb28e1f803c7a792b9f990f2aa6d57521
API Parse request fails from time to time which causes PHP notice
error. In order to understand whats going on lets introduce error
logging as temporary solution. This will give us possibility to
find the error instead of silently returning null. For now we will
keep old behaviour and return null in that case explictly. This will
avoid future php notice errors.
Changes:
- when API parse request fails log the error and return null
Bug: T169017
Change-Id: Ib908821b76a1e8b59235643854752c4f5910a274
Use the same expiry as the parser cache since this is a derivative of
the parser cache.
And avoid wfMemcKey while we're at it.
Change-Id: Ieba084aff4b8beb180da01d9cc4b8a2857569171
It confuses the code that munges the HTML to produce an extract.
By itself this won't fix the bug, but together with a core change to
avoid polluting the parser cache such as I5be25c6d it should work.
Bug: T165161
Change-Id: Ia1b654bf659958c04d7e370d4686cf17f615b591
Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.
Change-Id: Id9e8fb026b26bb4db34fb22bd631205ce6f7072b
All API calls supports the generic parameter variant.
With I8a31dfd3cf2a3e8f768907084d26a77f198ccbe3 in core this parameter
is documented and generates no warning anymore.
Bug: T117529
Change-Id: Ic7e6f1df99c67ad4132c22503d99345611af271a
Moved most of TextExtracts.php to the new extension.json
and added method for backward compatable implementation
of the extension if still called though the php file. Moved
unit test hook to Hooks.php and deleted old il8n.php.
Bug: T87979
Change-Id: I3d26bd931ad2941268b94474f3e6327282da24ec