Commit graph

461 commits

Author SHA1 Message Date
Timo Tijhof 9d3ee77a95 tests: Remove PHP 7.4 workaround
Follows-up 955e0bb. Some of the other test cases already did this,
so let's do it here as well.

Change-Id: Ib39b03a38ff0d444568980db39a4d9b1e54618b7
2020-03-13 22:54:52 +00:00
Aaron Schulz e9d466f398 Convert $wgMemc use to WANObjectCache
Bug: T160813
Change-Id: If298927d6b90e1b94e83485e723f13aa2bad0932
2020-03-13 21:07:36 +00:00
Thiemo Kreuz 955e0bb5bb Fix PHP 7.4 compatibility
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
2020-03-13 20:59:58 +00:00
libraryupgrader bd2e751655 build: Updating acorn to 7.1.1
* https://npmjs.com/advisories/1488

Change-Id: I96c26ef0223c1ad4450584453eabc75505e220ce
2020-03-08 14:31:47 +00:00
libraryupgrader fc5a68abd3 build: Updating composer dependencies
* jakub-onderka/php-console-highlighter: 0.3.2 → 0.4.0
* mediawiki/minus-x: 0.3.2 → 1.0.0
* mediawiki/mediawiki-phan-config: 0.9.0 → 0.9.1

Change-Id: Iecca5b2b282ea0a6748ec8349cbf3234e507f087
2020-01-30 07:37:37 +00:00
libraryupgrader 7025be47c1 build: Updating dependencies
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
2020-01-15 09:17:22 +00:00
jenkins-bot 66dd863e2c Merge "build: Updating mediawiki/mediawiki-phan-config to 0.9.0" 2020-01-15 08:35:38 +00:00
Translation updater bot 6ac7e5de12 Localisation updates from https://translatewiki.net.
Change-Id: Iabd4622829e404bfe5eeb24dbd660377ce81a839
2019-12-26 16:22:04 +01:00
libraryupgrader 5986441375 build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Don't pass booleans to BagOStuff::makeKey()

Change-Id: I87e42cee60d0adefd94f4bdc7fbbfabc65b7c93e
2019-12-21 23:44:50 -08:00
jenkins-bot 009161db33 Merge "Remove unused 'OpenSearchXml' hook handler" 2019-12-20 16:59:06 +00:00
libraryupgrader 871f84833f build: Updating mediawiki/minus-x to 0.3.2
Additional changes:
* Added .eslintcache to .gitignore.

Change-Id: Ia78e645acb6cbdf1e557ee2c0a011cce4130b702
2019-12-18 11:38:44 +00:00
Timo Tijhof 0453a3155f Remove unused 'OpenSearchXml' hook handler
This is the equivalent of the current 'ApiOpenSearchSuggest' hook
as it once existed in the "OpenSearchXml" MediaWiki extension,
which merged into core and archived three years ago.

Change-Id: Ibe244851857ddff3a437acb12c3cc7660eb89089
2019-12-16 18:34:19 +00:00
libraryupgrader 4508eae90a build: Updating grunt-banana-checker to 0.8.1
Additional changes:
* Added .eslintcache to .gitignore.

Change-Id: Ie4e45aa7ad1346f3d603d13dd259ce0f64447235
2019-12-15 02:24:24 +00:00
Translation updater bot 1087c8e37f Localisation updates from https://translatewiki.net.
Change-Id: I74e1aad5fb126989cc7961cc4582205670de69d7
2019-12-02 09:23:55 +01:00
Umherirrender 6297b90b96 build: Updating mediawiki/mediawiki-phan-config to 0.8.0
Bug: T235049
Change-Id: I530dee68a6d541162498a56841d13a557c7aed59
2019-11-05 17:01:08 +01:00
James D. Forrester d8eda5744f build: Upgrade mediawiki-codesniffer to v28.0.0
Change-Id: Ia1b33a8f268e6977ae32341a2b6b1e2f1603d776
2019-10-11 13:00:28 -07:00
Translation updater bot 17e82b03ef Localisation updates from https://translatewiki.net.
Change-Id: I3afed67c3eeb04188c4be65a2d6e478c7821c814
2019-09-16 09:57:25 +02:00
DannyS712 4c94bec18f Use Special:MyLanguage in API help links
Bug: T231269
Change-Id: I242981f4f7ecbd31fe4052daee8652089f4c6694
2019-08-27 06:44:46 +00:00
Translation updater bot ec635c314d Localisation updates from https://translatewiki.net.
Change-Id: I2163c049ee1f93377871c2b2e6e6125e16927bbc
2019-08-25 10:32:02 +02:00
Alex Monk 7683625d9e Split apihelp messages to a separate file
Bug: T189982
Change-Id: I719dd65bfe502094fa7b12d5d67d45f92d9daf5b
2019-08-25 00:00:59 +01:00
libraryupgrader 2289f56998 build: Updating eslint-utils to 1.4.2
* https://npmjs.com/advisories/1118

Additional changes:
* Added .eslintcache to .gitignore.

Change-Id: Iaa987c50c90ba717ce14a35ea392c3afbda7fbcc
2019-08-23 06:38:04 +00:00
Max Semenik c0b9bd8b77 Add more TextTruncator tests
This will take it to 100% coverage.

Change-Id: I835ac5795f15c65f07f47e9c00295d391dbf90ab
2019-07-17 20:29:00 -07:00
libraryupgrader ed0f255d9f build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 24.0.0 → 26.0.0

npm:
* lodash: 4.17.11 → 4.17.14
  * https://npmjs.com/advisories/1065
  * CVE-2019-10744

Change-Id: I7f08d7b9906e407cbc06198c8ae726df1e8e8ed0
2019-07-16 03:04:10 +00:00
James D. Forrester b39beef59b build: Upgrade phan-taint-check-plugin from 1.5.x to 2.0.1
Change-Id: Icf908ab86776d7a12ed0eeee2899623d8d03fad3
2019-07-09 14:18:47 -07:00
Translation updater bot 506ebc1d86 Localisation updates from https://translatewiki.net.
Change-Id: I6b83ed6fc4f8a0cb8a8f2bece6fa6a06e4ba42c4
2019-07-03 22:46:28 +02:00
Translation updater bot 89be536867 Localisation updates from https://translatewiki.net.
Change-Id: I2842a8bcdcef2a2dcadb6f6058a33aca527de2fc
2019-06-30 22:39:40 +02:00
Nicholas Ray 2f71245dc6 Build: add package-lock file
Add package-lock file. The previous version of Node.js did not support
package-locks but v10.15.2 does.

Bug: T179229
Change-Id: I06161513ebbaaa8b895c480038c36835bfe83f80
2019-06-27 12:05:29 -06:00
Translation updater bot 552a6df826 Localisation updates from https://translatewiki.net.
Change-Id: I98bc47bb20c4bea2aec796418f522cbce5a123c8
2019-06-24 08:39:58 +02:00
libraryupgrader 77f88b2edb build: Updating mediawiki/mediawiki-phan-config to 0.6.1
Change-Id: If493b81f311980c08edb37e9783469696acb4ad8
2019-06-10 12:01:22 +00:00
James D. Forrester 081e8e6b74 build: Upgrade mediawiki/mediawiki-phan-config from 0.5.0 to 0.6.0
Change-Id: I002ccea301dc2d008756714974ff55b73db29ab1
2019-05-19 13:36:07 +02:00
James D. Forrester f2cbf77787 build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint
Change-Id: I764c24fcd33a1732bb228fd68cde919f8bd5273e
2019-05-07 10:52:31 -07:00
Thiemo Kreuz 8de415c4fd Fix truncate code potentially removing whitespace from extract
By turning the (?:…) into (?=…) they become lookaheads and are not
part of the returned string in $tail any more. This is exactly what we
want here. All we want is to *know* if the dot, question or exclamation
mark is followed by a space. But we don't need the space captured.

Change-Id: I4be715c4c084165e5ab25da77609f12ffce4d385
2019-05-03 08:46:29 +02:00
Thiemo Kreuz 81fd92685a Move Tidy functionality to TextTruncator
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
2019-05-03 08:46:27 +02:00
jenkins-bot 8567e067f2 Merge "Extract unrelated static code from ExtractFormatter" 2019-05-02 21:03:58 +00:00
jenkins-bot 112caed347 Merge "Consistently mention the @license in all files" 2019-05-02 21:00:35 +00:00
Umherirrender 2e76760c2c Add phan
Change-Id: I2b76d0689ac6a79d5c67284ddccad49f34e05edb
2019-04-27 21:23:26 +02:00
Thiemo Kreuz 8d3ff14a93 Consistently mention the @license in all files
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
2019-04-24 18:26:53 +02:00
jenkins-bot 2b0440341c Merge "Inline nested callback functions" 2019-03-23 07:26:13 +00:00
Thiemo Kreuz a0d37fcb51 Extract unrelated static code from ExtractFormatter
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
2019-03-21 12:38:13 +00:00
Thiemo Kreuz 6a082f1764 Inline nested callback functions
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
2019-03-19 18:50:03 +01:00
Thiemo Kreuz b6250d3791 Add missing test cases for ExtractFormatter
This is especially covering:
* The behavior on different kinds of HTML encoded characters.
* Trimming, or more precisely the fact that the formatter currently does
  not do all the trimming. There is a trim() call in the test that should
  not be there. This will be reworked in a following patch.

Additionally:
* Prefer strict assertSame() where possible.
* Remove two assertions that don't help making the test more safe.
* Utilize the new `// phpcs:…` syntax.

Change-Id: Ic361f2644300dcef3fc972a2dc2ae19ad34fa513
2019-03-19 17:58:32 +01:00
Max Semenik e234409518 Use AutoloadNamespaces
Change-Id: I4cbf02365c6a33431e6614d971ac12f0a67823a9
2019-03-17 18:32:26 -07:00
Max Semenik 070b13d595 Remove PHP entry point
Change-Id: I6e8de0188e70ae77895eca79b4af7a168c0ffd88
2019-03-17 18:29:40 -07:00
Max Semenik b9a21cc865 Better way to detect if Tidy is on
Change-Id: Ie9723ef50d9a472605da92faabced3d852ec9387
2019-03-17 18:19:34 -07:00
Max Semenik 1bdb8410ac Get rid of useless ApiQueryExtracts->parserOptions
Change-Id: I084116998ba758c90f14a370c24d098cbd6cdc28
2019-03-17 18:02:11 -07:00
Max Semenik 0215eae3aa Make ExtractFormatter not depend on configuration
Change-Id: I4e9a0947bf50d062ea28004bde30d2e8b18788a4
2019-03-17 18:02:09 -07:00
Max Semenik 1017e3ab72 Remove compat with old MW
Change-Id: Ic5c44414b49e434a8c46ba3dca01eebe9e0f1d3c
2019-03-17 13:47:38 -07:00
Translation updater bot 4eb35661f7 Localisation updates from https://translatewiki.net.
Change-Id: I6c54abeec3d5a15f507484be60794256a8d59ccd
2019-02-14 22:29:32 +01:00
Thiemo Kreuz ed1f73365f Add test cases for all (private) memory caching helper methods
This patch does two things:

* Add a testMemCacheHelpers() test for the setCache(), getFromCache(),
as well as cacheKey() methods.

* Simplify the existing test setup utilizing the PHPUnit4And6Compat
layer. I'm also replacing the Config mock with an actual HashConfig,
because that's a really trivial object that does not need to be mocked.

Change-Id: I7e8a62651a53919d338a7d921f548e941b671670
2019-02-13 14:37:24 +01:00
Thiemo Kreuz ca83bbfd3b Improve coverage for mostly untested ApiQueryExtracts
Instead of trying to come up with a (probably hypercomplex) integration
test for the entire API module, I start to test a few more critical
details. Yes, this is now testing private implementation details. This
is meant as a migration path. See, it's hard to test code like this
without rewriting it, and hard to rewrite it without tests. This patch
aims to give us a little more confidence for future rewrites.

Change-Id: I0405e13eba31124fcb5af83159d7438fe0ad9879
2019-02-11 17:37:20 +01:00