Commit graph

118 commits

Author SHA1 Message Date
jenkins-bot
2901b84c49 Merge "TemplateParser: Pass FLAG_MUSTACHELOOKUP to enable parent context access" 2018-09-05 00:33:42 +00:00
Roan Kattouw
3c06d76521 TemplateParser: Pass FLAG_MUSTACHELOOKUP to enable parent context access
This allows variables defined in an outer context to be used in inner
contexts. For example:

<h2>{{foo}}</h2>
<ul>
{{#things}}
    <!-- bar is a property of each thing, foo is an outer variable -->
    <li>{{foo}} is a {{bar}}</li>
{{/things}}
</ul>

Bug: T203209
Change-Id: Ib0ae0fb0b4be6b161f548c79db6fb6f4b831f7c1
2018-09-04 12:39:34 -07:00
MGChecker
eb6b4d8e7e registration: Add ability to check if a specific extension version is loaded
As it's quite common that extensions and skins interact with each other, it's
useful to have a simple way to check if an extension version satisfies a
given constraint, as extensions change over time.

Bug: T202955
Change-Id: I19f9713caf89d647072a2bd7d598e739be383f4a
2018-09-03 14:37:33 -07:00
Stanislav Malyshev
ba5bce123b Fix handling categorization changes
Previously, we handled categorization changes using wrong assumptions
- that rc_cur_id refers to the parent category. Instead, it refers to
the child page.

Change-Id: I40e886c3548ccca57db7ab83f14ec4dcd804cf2f
Bug: T201216
2018-08-14 00:40:08 +00:00
Stanislav Malyshev
6aec8dd6fb Use separate insert/delete statements to work around Blazegraph bug
Bug https://github.com/blazegraph/database/issues/100 happens on DELETE/INSERT
but not on separate delete and insert, try to work around it

Change-Id: Iba6a98dde6f4bea9051cd6dee91fb19db5eca10e
Bug: T201217
2018-08-13 23:24:52 +00:00
Derk-Jan Hartman
25c293cadc SVG: Allow , as separator in viewBox attribute value
The viewBox attribute of the <svg> element allows both whitespace and
commas to be used as field separators.
https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute

Bug: T194192
Change-Id: Iae9be3e4fad3a8ffa411d7a76eee2f20cc39b718
2018-08-11 00:16:43 +02:00
Florian Schmidt
45cebbe9f6 registration: Validate no duplicate keys exist in extension.json
The JSON specification permits duplicate keys, but doing so is almost
always nearly a mistake.

We can use the JSON lint library (added as
dev-requirement to composer), which is now also used to decode the
JSON (as it's the same step as validating the JSON).

Bug: T153507
Change-Id: Ia713a1906169333c1aa2aebdc0ed060d26428d72
2018-07-18 09:29:43 +00:00
Kunal Mehta
2ecb2c944f Use wikimedia/xmp-reader library
Bug: T100922
Depends-On: I9bec4e03c49baafda30fb44cc793fa31b36e400d
Change-Id: Ic9044bf3260d1a474a6c74844949602441ffc865
2018-05-31 19:24:39 -07:00
Antoine Musso
224864ebdd registration: Initialize PSR-4 namespaces at same stage as normal autoloader
readFromQueue() injects the content of AutoloadClasses to
$wgAutoloadClasses however it missed doing the same for
AutoloadNamespaces.

When using the installer with an extension having AutoloadNamespaces
set, its classes would not be found.

Make ExtensionRegistry append to AutoLoader::$psr4Namespaces, and add
a test to cover the new behavior.

Bug: T195783
Change-Id: Id61155867a4ca7d9bc4a347f8671da74b0fa490b
2018-05-30 13:07:42 -07:00
Kunal Mehta
b165908616 Improve ExtensionRegistry test coverage
Change-Id: Id1b87e020a220c96b42d86485da67d47b9d565f9
2018-05-27 20:36:41 -07:00
Kunal Mehta
dc4fb23cfa Improve AutoLoader test coverage
Change-Id: Iddb24cad41979a4798392ab08d104dac41ed736d
2018-05-26 21:29:36 -07:00
jenkins-bot
c5a1a7372f Merge "resourceloader: Add test case for ResourceLoader::getLessCompiler" 2018-05-20 08:50:48 +00:00
Kunal Mehta
399b391f24 registration: Perform extra validation for mediawiki.org URLs
If the "url" field in extension.json is pointing to mediawiki.org,
perform some extra validation steps:
* Require HTTPS
* Require the `www.mediawiki.org` canonical domain

Change-Id: I3371443d3f6c76f53437adf90a700969bba7d0e7
2018-05-19 16:26:15 -07:00
Timo Tijhof
f4d1039a20 resourceloader: Add test case for ResourceLoader::getLessCompiler
This was previously covered implicitly by an unrelated test.
Change that test (dependency.less) to use ../ to access the file
directly so that that test case is only about tracking dependencies
and testing the parser.

Then, add a second case that tests the use of import dirs.

Bug: T140807
Change-Id: Ie85abffe313922c03b3e146422f36b1d6a79743d
2018-05-19 23:06:54 +00:00
Stanislav Malyshev
bc9e1a086e Create update SPARQL for category changes
This script creates SPARQL UPDATE statements for changes in a given time
period. These statements can be applied to an existing database to
update it.

See tests for examples of how the statements look like.

Bug: T173774
Change-Id: I9867ad566c0619b55a48a011bd3c55321b1bfcff
2018-04-20 16:40:35 -07:00
Kunal Mehta
2d5c742db3 Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: I4cbb98ea2bbacf46a57401dbba2bdb076fca1d3a
2018-03-18 18:08:22 +00:00
Brion Vibber
323aa02933 Adjust tests for JPEG segmentation fix
Added a second test case truncated in a different place, and
added some clarifying comments.

Change-Id: I7b8e5296a203264b7e7e428f82c8c948242a1272
2018-02-23 12:29:35 +00:00
Brion Vibber
225dae4ab5 Fix infinite loop in JpegMetadataExtractor
One of the skip-over loops was missing an feof() check and could
cause infinite loops.

Includes test file created by truncating a tiny tiny .jpeg at
the right place...

With the fix, it doesn't loop but dies on an exception, which
is good!

Bug: T184048
Change-Id: Ica13d6b68c3c12f7ce414edd081bf0886714e465
2018-02-21 23:31:15 +00:00
Kunal Mehta
08b2cf6638 Add tests for ExtensionJsonValidator
Change-Id: I883a502fc3ed6cd7b8651d9e5e78dba7177ead9c
2018-02-09 23:37:22 -08:00
Stanislav Malyshev
dc2fd34eb1 Add more data to categories dump
Hidden category: <cat> a mediawiki:HiddenCategory .
Pages count: <cat> mediawiki:pages 10 .
Subcats count: <cat> mediawiki:subcategories 5 .

Note that pages count includes only actual articles, unlike mediawiki
table.

Bug: T173980
Change-Id: I6d34c58f844411f891195776406e11acd2aef7b1
2018-01-17 00:40:16 +00:00
jenkins-bot
58858df842 Merge "Port categories dump header fix" 2018-01-17 00:19:43 +00:00
Volker E
cdf11dff65 CSSMin: Remove XML declaration from SVGs
Removing unnecessary XML declaration prolog when embedding SVGs
as data URI and adding more complex elements & attributes to test.

Bug: T175318
Change-Id: Ibec8c2ab498554a6ad33b4420ae6258dcc80fcdf
2018-01-11 19:28:15 -08:00
ryan10145
7d05534e88 Added tests for ComposerInstalled
Bug: T183899
Change-Id: Id822caad044a079884795dbea37baf10514bcf5c
2018-01-10 05:55:47 +00:00
Stanislav Malyshev
bb2453fa7c Port categories dump header fix
This fix is ported from https://gerrit.wikimedia.org/r/#/c/372905
since it does not belong to SPARQL updates really.

It changes main node for category dump to
<http://acme.test/wiki/Special:CategoryDump>
thus allowing to support multiple wikis living on the same domain.w

Change-Id: Ie1ac5ddf6b3b73f3966274f90abc1db50061b494
2017-11-28 18:04:43 -08:00
jenkins-bot
15695b1eef Merge "Add a few schemas to SQLite tests" 2017-10-17 22:37:32 +00:00
Fomafix
3af1e25343 Replace HTTP by HTTPS in docs
Change-Id: I311c40f8aa90f308a0817f4c3ce1b9449b1f5ca7
2017-10-15 11:11:16 +02:00
Max Semenik
ee44a10c3d Add a few schemas to SQLite tests
Change-Id: I09f2f98100b7bd74abc468b612dc6e90d95975c7
2017-10-13 19:39:06 +00:00
Roan Kattouw
a4631b92e7 Improve encoding of embedded SVGs
Unencode spaces, slashes, colons and equals signs.

Bug: T175318
Change-Id: Idebdfca8f93d5e090deba5bf5a256d7054e2d6c8
2017-09-14 11:39:57 -07:00
Gergő Tisza
49350108bf Enable recursive partials in TemplateParser
Recursive partials are the only way to handle tree-like structures
such as nested lists. Allow setting FLAG_RUNTIMEPARTIAL in LightnCandy
so they can be used.

Since this has a slight performance impact (makes partial invocations
evaluation-time functions calls instead of compilation-time transclusions)
make it optional.

Change-Id: Ie37105a9f1ff92e1a79bfcd9f8578965e3d347f0
2017-09-10 05:51:07 +00:00
jenkins-bot
a8ec960e9d Merge "Produce RDF dump of all categories and subcategories in a wiki." 2017-08-28 11:01:58 +00:00
Stanislav Malyshev
d9bb673b72 Produce RDF dump of all categories and subcategories in a wiki.
Example:
http://en.wiki.local.wmftest.net:8080/wiki/Category:Ducks> a mediawiki:Category ;
        rdfs:label "Ducks" ;
        mediawiki:isInCategory <http://en.wiki.local.wmftest.net:8080/wiki/Category:Birds> .

Bug: T157676
Change-Id: I59b9603581b37af59d17dd6c38247c85aee44911
2017-08-28 00:30:35 -07:00
jenkins-bot
3639515010 Merge "MimeAnalyzer: Add testcases for mp3 detection" 2017-08-09 16:36:23 +00:00
Timo Tijhof
d3e31c7ea4 resourceloader: Add basic tests for getScript() and buildContent()
Bug: T162719
Change-Id: I37d64da77682adfef61e78033d639b623d7c9c2b
2017-06-26 22:15:17 -07:00
Derk-Jan Hartman
c6235442b4 MimeAnalyzer: Add testcases for mp3 detection
This is a follow-up to change Ie1a63aa

Bug: T115170
Change-Id: Iab5e19e1dd26b0d88c72ad7253cd11e865c5e008
2017-06-08 00:27:33 +00:00
Bartosz Dziewoński
efd707de37 Rename all files used in ResourceLoaderImageModule tests to fake names
Using names that match real OOjs UI icons is confusing when trying to
find usages of the real icons and when debugging the tests.

Bug: T166730
Change-Id: Ibb97c0347476efc95f1a50c97822d7dab19737f2
2017-06-06 13:17:29 +00:00
James D. Forrester
7668836236 Update OOjs UI to v0.22.1
Release notes:
 https://phabricator.wikimedia.org/diffusion/GOJU/browse/master/History.md;v0.22.1

Depends-On: I4ee36222e67697a7290a1ac94788676e476ca768
Change-Id: I964a298018d837b1a05a1608a81ca0544f34a2c8
2017-05-31 12:27:05 -07:00
jenkins-bot
2dd58ade75 Merge "Embed TinyRGB color profile when JPG EXIF Color Space = sRGB but no profile embedded" 2017-05-04 07:59:08 +00:00
Gergő Tisza
525bfbc8df Switch to librarized version of TestingAccessWrapper
Replaces \TestingAccessWrapper (defined in core) with
\Wikimedia\TestingAccessWrapper (defined in the composer package
wikimedia/testing-access-wrapper).

See https://gerrit.wikimedia.org/r/#/q/topic:librarize-testing-access-wrapper
for downstream patches.

The core version of the class is kept around for a while to avoid
circular dependency problems.

Bug: T163434
Change-Id: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 14:15:57 +00:00
Bartosz Dziewoński
b6a238e6bf resourceloader: Add unit tests for ResourceLoaderImage
Follows-up I5b14d65a and I5a563c59.

Change-Id: Id42e1b868c9fe97cdb14b4bc7328947820a7fd94
2017-04-11 21:55:59 +00:00
Brion Vibber
bf2c7b02b8 Add test case for Opus file check
Test case for Opus file check so we don't regress!
Confirms the fix for T151352 that Opus files return
type 'audio' and not 'multimedia'.

Bug: T151352
Change-Id: Ib868793d90b60609ccec25726e6fbaa28bffebaf
2017-01-17 13:24:16 -08:00
jenkins-bot
9964ca1a39 Merge "Don't fallback from uk to ru" 2016-11-29 08:00:43 +00:00
Adam Roses Wight
98585221d6 Don't fallback from uk to ru
Bug: T39314
Change-Id: I7c72702524bb75bb939a30b6c8e451ae8f89e906
2016-11-23 19:24:54 +02:00
Matthias Mullie
a428e3f067 Embed TinyRGB color profile when JPG EXIF Color Space = sRGB but no profile embedded
Existing srgb.jpg & tinyrgb.jpg have been replaced to be able to
easily compare a "fixed" missingprofile.jpg to tinyrgb.jpg.
With the existing files, when the tinyrgb profile was added to
missingprofile.jpg, it would end up basically the same as tinyrgb.jpg,
except that not all the exif data would be in the exact same order.
I've rebuilt srgb.jpg & tinyrgb.jpg by first removing their profile
(which is what missingprofile.jpg is), and then copying it over again:
    exiftool -tagsfromfile srgb.jpg -ICC_Profile new_srgb.jpg

Meanwhile also moved the profile-swapping code to JpegHandler, as it
was jpeg-specific.

Bug: T134498
Change-Id: I722dd6f66f6007182ad9a215e5eb382776983c05
2016-11-15 12:17:31 +00:00
Bartosz Dziewoński
19d692051f UploadBase: Permit SVG files with broken namespace definition (Inkscape bug)
Inkscape mangles namespace definitions created by Adobe Illustrator
(apparently it can't parse custom entities or something, maybe just
in 'xmlns' attributes). These files are still valid SVG, and not
a security issue (although Illustrator probably won't like them),
so it's okay to allow them.

Added tests with some example files.

* buggynamespace-original.svg
  File generated by Illustrator (edited by hand to reduce filesize).
  Based on <https://commons.wikimedia.org/w/?curid=16495597>.

* buggynamespace-okay.svg
  The original file, opened and saved in Inkscape (no other changes).

* buggynamespace-okay2.svg
  The original file, opened and saved in Inkscape twice.

* buggynamespace-bad.svg
  The original file, edited by hand to remove custom entities.
  This is not valid XML and should be rejected (although it's valid
  when parsed as HTML, and some image viewers might display it).

* buggynamespace-evilhtml.svg
  An SVG file using an entity declared namespace for a namespace
  we want to ban. Based on buggynamespace-original.svg.

Bug: T144827
Change-Id: I0eb9766cab86a58d729f10033c64f57d2076d917
2016-10-27 10:24:32 +00:00
Timo Tijhof
1456c228d7 Remove unused conds.mustache test file
Follows-up 2b7d281 which added the file but no use of it.

Change-Id: I59faab7f50abedeb1d57663128872032b6ec28a2
2016-08-01 17:16:52 -07:00
Derk-Jan Hartman
844199e67c resourceloader: Strip leading BOM when concatenating files
We read files and concatenate their contents. Files may start with a BOM character.
BOM characters are only allowed at the beginning of a file, not half way.
Stripping it should be safe, since we already assume that everything is UTF-8.

Change-Id: I14ad698a684e78976e873e9ae2c367475550a063
2016-05-31 19:47:19 +01:00
Brion Vibber
a30bc4f7e0 Enable 4:2:0 chroma subsampling for JPEG thumbnails
* Add $wgJpegPixelFormat, default to 'yuv420'
* Implemented for ImageMagick via CLI and extension
* Currently ignored for other scaler backends
* Added test case to run when using ImageMagick

4:2:0 subsampling can save an average of 17% bandwidth
over 4:4:4 subsampling, at the cost of some artifacting
at sharp red or blue edges. This is usually not noticeable
in photographic images.

To restore the previous behavior, set to false:

  $wgJpegPixelFormat = false;

which will maintain the original file's pixel subsampling
settings in the thumbnail.

Can set explicitly to one of:

  'yuv444' - never subsample
  'yuv422' - subsample 2x horizontally, not vert
  'yuv420' - subsample 2x in both dimensions

Bug: T129128
Change-Id: Ib9cb36c3a7e6a69d66c11150ef4a1d02dbac2df5
2016-04-27 15:36:18 -07:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Gergő Tisza
c4273e28e2 Handle static access in TestingAccessWrapper
Change-Id: Ia8ec6ee0a364807e78fc182c4ce99d782b921eda
2016-01-24 22:24:10 -06:00
Derk-Jan Hartman
175e95a909 ParserTests: Add a video file to parser test suite
Introduce an ogv video file to the parser file testsuite, so that we
can use it later in TimedMediaHandler parsertests.

Change-Id: I6a3b307ad9c82e9df0aeec025934d736eec8375f
2016-01-07 13:24:43 -08:00