Commit graph

325 commits

Author SHA1 Message Date
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
Translation updater bot 9b7f77b8b5 Localisation updates from https://translatewiki.net.
Change-Id: I60e89bf3e733dd1f2c5363d66c52e62712161877
2018-07-17 22:14:06 +02:00
jenkins-bot 6c36417f4c Merge "Remove unused ParserOptions from ExtractFormatterTest" 2018-07-01 23:37:27 +00:00
Thiemo Kreuz 60cd40b975 Remove not needed count() and "return true" from hook handlers
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
2018-06-28 20:45:20 +02:00
Thiemo Kreuz 9f99628c1f Remove unused ParserOptions from ExtractFormatterTest
Change-Id: I685b468ad13da73b6273041f6ff068c2d8b730d0
2018-06-28 20:44:46 +02:00
Translation updater bot f607ff8d6c Localisation updates from https://translatewiki.net.
Change-Id: I1e6f035ccec4d52d3cd4fc7187b19679b2d75a67
2018-06-24 22:26:03 +02:00
libraryupgrader 138908a926 build: Updating mediawiki/mediawiki-codesniffer to 20.0.0
Change-Id: I1d30fed4bc490b4e598b3439ab10f8fa5790a953
2018-05-26 06:54:00 +00:00
Translation updater bot 4afe1f40f5 Localisation updates from https://translatewiki.net.
Change-Id: I52d0115344c7ead3a16c37b7e511d4126f8f64f6
2018-04-27 22:26:16 +02:00
Translation updater bot 7b00e9aa6e Localisation updates from https://translatewiki.net.
Change-Id: I9803a505e310e98596550212ecaa1e49f79b0dea
2018-04-15 22:23:37 +02:00
libraryupgrader fd2754ee40 build: Updating mediawiki/mediawiki-codesniffer to 18.0.0
Change-Id: Ida68791e01c26fd4058718718dbede561d02de05
2018-04-14 07:02:44 +00:00
Translation updater bot 51f9abef91 Localisation updates from https://translatewiki.net.
Change-Id: Ia59e0be6caa7fe59bc84c866679dfbdfa9990d86
2018-04-13 22:13:02 +02:00
Translation updater bot 00077b2f74 Localisation updates from https://translatewiki.net.
Change-Id: I7d2a9f6d7cd986b66d6fd49e766140bc959ee020
2018-04-11 22:40:30 +02:00
Umherirrender 618aef40a0 Remove @return from __construct
Change-Id: I2000dc076c869620533368431f6c55241fbc92e8
2018-04-05 12:18:59 +02:00