Commit graph

287 commits

Author SHA1 Message Date
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
libraryupgrader cc8cd45901 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: Ibc59cb3fbe6e9c52d074c308293f4fdd48720560
2019-02-07 05:27:44 +00:00
Fomafix 375f6d3574 Use PHP7 syntax features
* Use the ?? operator.
* Use "\u{00A0}" instead of "\xC2\xA0".

Also increase the minimum required MediaWiki version from 1.30 to 1.31
because 1.31 requires PHP7.

Change-Id: Ic5c279976f50b381cec65e74b7cc821a210c2173
2019-02-02 21:58:54 +01:00
Translation updater bot 6b74bd346e Localisation updates from https://translatewiki.net.
Change-Id: Ic896e51ed2aa2ec09a5c30c9ee33f29203b7db27
2019-01-17 09:12:59 +01:00
Kunal Mehta defcf9ae8c build: Set "root": true, in .eslintrc.json
This ensures that each repository's "npm test" command is fully
independent of wherever it might be in the filesystem.

Bug: T206485
Change-Id: I370cbae95ae15c546f6d70fcab50a4506e129ef1
2018-12-17 18:58:48 -08:00
Ed Sanders 870742e389 build: Update devDependencies
Change-Id: I37d1b6efe55f91ba3c411a06a4c57b4f591ba460
2018-11-26 23:41:56 +00:00
libraryupgrader 251686a88f build: Updating mediawiki/mediawiki-codesniffer to 23.0.0
Change-Id: I99fb9907c01700a780ca44958f2a4add294c1701
2018-11-16 14:38:51 +00:00
Translation updater bot 96f8b3e57b Localisation updates from https://translatewiki.net.
Change-Id: Ie3b52cbd5af270c0bd643cc345f5f86617f861b7
2018-10-25 22:39:03 +02:00
libraryupgrader 012b89e966 build: Updating npm dependencies for security issues
* Updated grunt to 1.0.3, addressing:
  * https://npmjs.com/advisories/577
  * CVE-2018-3721

Change-Id: I2cecb846c0c13ab5015f4ba182ca5bf40adf0a02
2018-10-11 11:16:53 +00:00
Translation updater bot 662e169cb1 Localisation updates from https://translatewiki.net.
Change-Id: Id9edd34ce15c46f8ac8cc4bb3b831ed3b38014ad
2018-10-04 22:24:26 +02:00
TheDJ 93076cf47e Raise mediawiki requirement to 1.30
Uses MediaWikiServices::getInstance()->getParserCache() only
available since 1.30

Bug: T205916
Change-Id: I388a09b443aa57ae88f36029a7656625373f82a1
2018-10-03 12:23:58 +00:00
Translation updater bot cd169cb9cf Localisation updates from https://translatewiki.net.
Change-Id: I35ed4ddd9a33efb14f925fc4351028e5927281a2
2018-09-22 10:04:03 +02:00
Fomafix 2fdd62e94e Start showing warning for deprecated PHP entry point
Also update required MediaWiki version to required version in extension.json.

Change-Id: Ifbeef2fe20f9491ed1bffaa322248f647492de7c
2018-09-10 20:57:50 +02:00
libraryupgrader bd206eace2 build: Updating mediawiki/phan-taint-check-plugin to 1.5.0
Change-Id: Idf6d9e3b80e39e7066d3780c8138cd46b2b8a265
2018-09-08 06:13:48 +00:00
jenkins-bot d9d37c0cc6 Merge "Add recent pattern for ESLinting in repo" 2018-09-06 05:43:56 +00:00
libraryupgrader 9ebc73470a build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
Change-Id: I9c8956d5b83f43ea93bfb3ad6664dca64892f76e
2018-09-03 20:02:49 +00:00
Alangi Derick 6f3840db35 Add recent pattern for ESLinting in repo
Use of all: '.' in Gruntfile.js for eslint config and
eslintIgnore in package.json to ignore linting the "vendor/"
directory.

Change-Id: Ic8489351b8de6b7e31a95a55420db1f772f8d535
2018-09-03 15:31:36 +01:00
libraryupgrader dda6fa48a1 build: Updating mediawiki/phan-taint-check-plugin to 1.4.0
Change-Id: I1f4f402ddc8bdc515c41703dc4c495d96bbf4b89
2018-09-01 14:49:31 +00:00
Translation updater bot 3c4ab649c7 Localisation updates from https://translatewiki.net.
Change-Id: I19c29fc4f41d2ce8ba1084c0be4dd4ebb17376e1
2018-08-29 22:28:29 +02:00
Umherirrender 832d0ff745 Remove use of deprecated UsageException
Deprecated since 1.29, extension required 1.29

Change-Id: I2f550f0b94571afc289af616645b822d63fea4d3
2018-08-21 22:23:49 +02:00
Translation updater bot 47923cb7f7 Localisation updates from https://translatewiki.net.
Change-Id: I483beb62113e3191c4ef42b8eecfc04afc912fe7
2018-08-19 22:39:08 +02:00
libraryupgrader 584ac209d6 build: Updating mediawiki/phan-taint-check-plugin to 1.3.0
And updating CoC link to use Special:MyLanguage (T202047).

Change-Id: Ia1a6d57e02dbb6cd7afeff984c7baccd2e211413
2018-08-19 17:07:56 +00:00
Umherirrender add3e27461 User constructor does not take an argument
User object without argument is the anon default

Change-Id: I2c47c4865386d59f14eb6390b3e12fb9c5198ccd
2018-08-06 23:12:26 +02:00
Kunal Mehta eab15dfe42 Configure phan-taint-check-plugin
The plugin checks and flags potential security issues (XSS, SQLi, etc.)
using static analysis.

See <https://www.mediawiki.org/wiki/Phan-taint-check-plugin> for more
details.

Bug: T201219
Change-Id: I0c81983a41a9c8863bd16c7d358b51472b7e9e9a
2018-08-03 21:31:26 -07:00
libraryupgrader 9ff2069079 build: Updating mediawiki/mediawiki-codesniffer to 21.0.0
Change-Id: I85ea2a4649a28440c04786911b29e24437b790cd
2018-07-27 20:09:11 +00:00