Commit graph

177 commits

Author SHA1 Message Date
Bartosz Dziewoński
4c01f8b2bc Make "/*@noflip*/ /*@embed*/" annotation work without CSSJanus hacks
This reverts most of commit 2d842f1425,
leaving only the test added in it, and reimplements the same
functionality better.

Instead of stripping /*@noflip*/ annotations in CSSJanus, which is
incompatible with other implementations that preserve it, extend
CSSMin to allow other CSS comments to be present before the
rule-global @embed annotation. (This required making the regex logic
in it even worse than it was, but it's actually slightly less terrible
than I expected it would be. Good thing we have tests!)

Bug: 69698
Change-Id: I58603ef64f7d7cdc6461b34721a4d6b15f15ad79
2014-09-23 22:47:54 +00:00
Timo Tijhof
bb5709241e CSSJanus: Add Apache license header
Follows-up f9e8d61 which removed the Python library and its copy
of the Apache license file.

Change-Id: Ic3ed4a2fb935e713916cb8eb6ba1673839f40532
2014-09-20 17:21:53 -07:00
Kevin Israel
eac059c722 Remove dead mime_content_type() code paths
Since PHP 5.3, mime_content_type() is implemented as part of PHP's
fileinfo extension and thus is deprecated in favor of the newer
alternatives provided by that extension (already in use).

Also updated a comment in DefaultSettings.php that mentioned the
function. Did not modify lessc.inc.php, a third-party library
maintained separately from MediaWiki.

Change-Id: Ic4a0873989ddb634ec9a05c3340941a9ba3f5ec5
2014-09-03 16:35:35 +00:00
Bartosz Dziewoński
2d842f1425 Make "/*@noflip*/ /*@embed*/" annotation work
To do it, just remove /*@noflip*/ annotations in CSSJanus after
we're done processing. They are not needed anymore and some obscure
interactions with CSSMin logic for preserving comments caused
`/*@noflip*/ /*@embed*/ background-image: url(…)` not to work
correctly (it would not be embedded).

This also requires us to always do CSSJanus processing, even when we
don't need flipping, to consistently handle the annotations.
I'm not entirely sure if this is worth it, but I still greatly prefer
doing it to documenting this stupid limitation. :)

Bug: 69698
Change-Id: I311b12b08b2dff9d45efb584db08cf4a11318f59
2014-08-18 17:40:51 +02:00
Aaron Schulz
0702671f2e Fixed doc comment
Change-Id: I906f3f34ac27207dd6b87b07fa6e791bc7b66691
2014-08-14 15:35:30 -07:00
rillke
c31fbf073e Unify the spelling of MIME in documentation
Writing MIME as written in Wikipedia and some documentation clean up.

Change-Id: I9dfc36d2bf55d72d9374c4075bd6d45eef0415a4
2014-08-07 23:38:45 +02:00
Shahyar
923ad97b3a Correct shadow flipping in CSSJanus
Was incorrectly assuming values between -1 and 1 were 0
Fixes an issue with mw-ui-input class in RTL mode which
makes use of box shadow.

Change-Id: I13e52467721bc2534e0a7c5245e3380ac43736ef
2014-07-30 23:14:32 +00:00
Timo Tijhof
3b229c06be CSSMin: Add link to css-syntax spec for url tokens on w3.org
Change-Id: I9bfd7016ba4ec106e1b92602fd6d8188b8b183f3
2014-07-12 02:00:55 +02:00
umherirrender
b18d8d7e01 Remove OutputPage::getStatusMessage() (deprecated since 1.18)
Also removed a comment where the method was mentioned.

Change-Id: I802f0f41e107a1d677fb899f6e09ea31df3c4e6f
2014-07-09 01:41:18 +02:00
Aaron Schulz
3993b6a4de Fixed broken exception code
Change-Id: Id399cb22f183d75acc006e698feb161bd12096bd
2014-07-03 16:37:25 -07:00
Stephan Gambke
3b1b2b0c33 Fix CSSMin url() remapping when comments in CSS contain curly braces
Remapping of url()s was thrown off if the CSS contained comments
with curly braces. To fix, replace all block comments (except @embed
directives) with placeholders before url() processing and swap them
back in afterwards. Patch also includes tests.

Bug: 60077
Change-Id: If18a93c17ea9bcd529f6a664aa2dcc51d4a37f38
2014-06-30 09:14:10 +00:00
Trevor Parscal
3e2fd810d2 Revert "Fix "CSSMin url() value remapping not working in certain obscure cases""
This reverts commit fa1053a16a.

Breaks CSS output, making the skin and extensions look unstyled.

Change-Id: I297150f775dd5559f91f2c9c25c64b134459c6b6
2014-06-10 22:04:40 +00:00
Stephan Gambke
fa1053a16a Fix "CSSMin url() value remapping not working in certain obscure cases"
This patch extends the regex used to find URLs by css block quote subpatterns.

Bug: 60077
Change-Id: Ife00d01b78c6369f20ffc49d20aa58e354a61ee7
2014-06-09 23:50:28 +02:00
Brandon Black
e323bc3393 Speed up CIDR matching from $wgSquidServersNoPurge
This adds a new generic library class IPSet, which precomputes
a reasonably-efficient data structure from the input list of
addresses and CIDR net/mask specs for fast runtime matching,
and then uses it to check trusted XFF-setters.

See also: 32b4f19f173fc5cff1029eedee63a39a2d72dd3a
Bug: 57021
Change-Id: Ia3b12fb90c3e7e492374a128943b014481cc2730
2014-05-15 17:23:12 +00:00
Siebrand Mazeland
c0c39640e4 Make phpcs-strict pass on includes/ (5/~10)
Change-Id: I259f3f11cfc22f3ed1693f9ebd5bd80491b8a6e8
2014-05-11 19:35:32 +00:00
jenkins-bot
06db1a2335 Merge "Added VirtualRESTServiceClient/VirtualRESTService classes" 2014-04-30 03:09:54 +00:00
Aaron Schulz
4d6d11d64b Added VirtualRESTServiceClient/VirtualRESTService classes
* Reference handling cleanup for loops in MultiHttpClient
* Support a slightly more convenient request array format for MultiHttpClient
* Added missing license header to MultiHttpClient

Change-Id: Icc86ed9e4c2ac78363aa7b6f3147253bb59e2afb
2014-04-29 17:01:25 -07:00
Siebrand Mazeland
40e04816f0 Pass phpcs-strict on includes/libs/
No changes to "real" libs. They are excluded from CodeSniffer tests.

Change-Id: Ifd14c0be24014fd9629a31e9bd155b27e2c0e93d
2014-04-24 21:48:10 +02:00
Siebrand Mazeland
9ef0e8bb84 Pass phpcs-strict on includes/libs/CSSJanus.php
Change-Id: I184a419a225d5503c5b72909bd69624eba690b0e
2014-04-24 21:46:54 +02:00
Erik Bernhardson
5ad0cd9b89 Update lessphp to 2cc77e3c7b
Source:
* b7cd5c79e8...2cc77e3c7b
* 2cc77e3c7b/lessc.inc.php

Updates:
* 84b1fda0d4 Set visibility of lessc::compileValue to 'public'

Change-Id: I499ddb01a662896fdcfe56d18021de5314e4d5d2
2014-04-23 03:30:02 +00:00
jenkins-bot
a21d59cc6e Merge "Make room for preloadFileStat() call in FileBackend::doOperationsInternal" 2014-04-21 17:13:35 +00:00
Aaron Schulz
d52a559fba Make room for preloadFileStat() call in FileBackend::doOperationsInternal
Change-Id: I60f71155abcf7f69423639b10ec301ac192df728
2014-04-18 17:02:19 -07:00
Aaron Schulz
f7f710287b Improved HashRing usage in JobQueueFederated
* Added proper ejection and caching in HashRing to avoid rebuilding
  the hash all the time (or doing manual caching).
* Made JobQueueFederated blacklist failing servers for a few seconds.
* Also made the JobQueueFederated root job methods properly respect
  the weights when they fail over.

Change-Id: Ifa4c03272c1777cfff2523ab21f780074ddcf359
2014-04-18 20:28:48 +00:00
Aaron Schulz
c6d766fb0e Set the "error" field in the right array
Change-Id: Id822ceb53c57daac0000bef3b304bb0260efe4ce
2014-04-07 13:15:31 -07:00
Faidon Liambotis
c4f14616c4 HttpStatus: add RFC 6585 status codes
Add newer (Apr 2012) HTTP status codes & their messages to HttpStatus'
getMessage. Adds 428, 429, 431, 511 per RFC 6585, "Additional HTTP
Status Codes".

Change-Id: Ia055880c4b2f3ac43cf5d94dbdd45a3690a58569
2014-03-28 12:25:14 +02:00
Aaron Schulz
400e4848ec Moved ProcessCacheLRU to /libs
Change-Id: I7052d04d9847f0310c1e62bd66365c813fddeab5
2014-03-16 16:32:34 -07:00
Bartosz Dziewoński
603174ff41 CSSMin: Don't do file_exists on random data in getLocalFileReferences()
If it's a URL, it obviously can't be a local file; check that first to
avoid PHP warnings about malformed paths.

Bug: 60960
Change-Id: Id784c089c3de8af79af7524ef5ab5cc2f7b8af9e
2014-03-10 20:55:02 +01:00
jenkins-bot
c81fc3208a Merge "Update lessphp to b7cd5c79e8" 2014-03-08 05:32:10 +00:00
Ori Livneh
7068472282 Update lessphp to b7cd5c79e8
Source:
* https://github.com/leafo/lessphp/blob/b7cd5c79e8/lessc.inc.php
* 261f1bd2...b7cd5c79e8

Updates:
 * 1d62556008: CS fixes
 * d3fd5cec9e: use the built-in php magic database instead of the system one
 * 34fdf60f32: data-uri: add tests and use lessc::findImport to locate the file
 * 72b25725d9: implement data-uri([mimetype,] url) from less.js 1.4.0
 * 5cf7eb272e: Update lessc.inc.php
 * 7e64e41a59: Fix color contrast and threshold calculation
 * 69adc23a92: Use property_exist to avoid "Undefined property: stdClass::$parent"

Change-Id: Ie626b4f1117b44669bd2c6c43a0186d95b36435a
2014-03-07 00:27:37 +00:00
Bartosz Dziewoński
ae839a0fac CSSMin: Clean up the logic in getLocalFileReferences()
The function used to check if the $path parameter is null on every
inner loop iteration, only to effectively return an empty array if it
was. Rephrased the code to say exactly that.

(Not sure what the behavior is good for, though…)

Change-Id: I716bfde581d3ed4c02f0d9f544beb9d0a1906261
2014-02-28 21:26:56 +01:00
jenkins-bot
ee3945f26b Merge "CSSJanus: Account for attribute selectors in brace lookahead" 2014-02-22 16:56:27 +00:00
Aaron Schulz
bc7f296240 MultiHttpClient tweaks
* Reference handling cleanup for loops in MultiHttpClient
* Support a slightly more convenient request array format for MultiHttpClient
* Added missing license header to MultiHttpClient

Change-Id: I0a2eef02c06d9c900c4a1ae1b0eeb292755d6cd9
2014-02-11 16:53:10 -08:00
Aaron Schulz
086d13957c Added pipelining and max connection support to MultiHttpClient
* Also added timeout options to the run()/runMulti() methods

Change-Id: I2b080567e17fa29804c36e3b259b1ce214e6f465
2014-02-10 17:56:21 -08:00
Roan Kattouw
e5096f2500 CSSJanus: Account for attribute selectors in brace lookahead
Recognize selectors of the forms [attr=val], [attr*=val], [attr~=val]
and [attr^=val], optionally with single-quoted values.

Because these selectors previously weren't recognized, trying to
apply /* @noflip */ to one of them would be recognized as a
single-property noflip rather than a rule-wide noflip, and so only
the first property in the rule would be noflipped.

The (simplified) input that triggered this bug was:

/* @noflip */ figure[typeof*='mw:Image'].mw-halign-left { clear: left; float: left; }

which became { clear: left; float: right; } when run through CSSJanus.

See also I4cddce80397d8 which is a workaround for this issue

Bug: 50910
Change-Id: If424a1df26bb7a5a18cee4b0318b029392528fc0
2014-02-08 00:43:52 +00:00
Reedy
05b70dc29e Remove unreachable statement
Change-Id: I79175695698a6ef393eff841580263c867719e25
2014-01-30 04:06:03 +00:00
mglaser
5205b03f62 SECURITY: Disallow stylesheets in svg
Bug: 57550
Change-Id: I73d148519c077e628d82a89280faa088bac9bdf5
2014-01-14 02:00:12 +01:00
Aaron Schulz
616df59b32 Fixed http_build_query warnings on PHP < 5.4
* bug: 59880

Change-Id: I2eae4bed17a72b58ac33f3538dd7d16f4356a3a0
2014-01-09 13:46:29 -08:00
Aaron Schulz
2af7ad827d Removed cloudfiles dependency in SwiftFileBackend
* Added a new curl multi wrapper under libs/.
* Used the new MultiHttpClient class instead of CloudFiles
* Removed CDN related config and code as it does not work.
  well due to mutating files and tiny purge rate limits by CDNs.
* Also removed the unused and esoteric 'swiftAnonUser' parameter.
* Support concurrent 'describe' operations.
* Set ACLs on containers on intial PUT instead of in two steps.
  Previously if the second step failed, prepare() would never
  set the ACLs correctly since it aborts if the container exists.
* Improve token deletion to only trigger on 401s rather than other
  random errors like 50X timeouts.
* Removed duplicative getResponse* code by just using one closure
  called for both the concurrent and serial cases. Both cases are
  now funneled through doExecuteOpHandlesInternal().
* Add the MD5 to stat info, as it might be useful for speeding up
  the copy scripts in some cases (when both backends have md5 set).
* Avoid use of trigger_error() since there is a swift log group.
* A few other small code cleanups.

Change-Id: I1adb3e2df6df8cf01d3ad74158de96ea9a79da2e
2014-01-07 23:56:34 -08:00
Aaron Schulz
bb519a91df Moved HashRing to /libs
Change-Id: I0b74b386f7459f550816f99aa7e00970c3cff4c7
2014-01-07 22:18:09 +00:00
Aaron Schulz
deec3478c7 Moved MappedIterator to /libs and changed exception type
Now throws UnexpectedValueException rather than MWException.

Change-Id: Id466b66f43db97c5837030d166b9abd66fd56e0d
2014-01-07 21:12:43 +00:00
jenkins-bot
6af536060e Merge "MWMessagePack: improvements to test suite, exception handling, array detection" 2014-01-03 09:06:10 +00:00
Ori Livneh
a7a5c414bb MWMessagePack: improvements to test suite, exception handling, array detection
* Throw InvalidArgumentException
* Use data provider in unit tests
* Detect associative arrays without copying

Per Tyler's post-merge review of Id2833c5a9.

Change-Id: Iec6b135238ca5da3002944066843102f0ae8d23d
2014-01-03 03:57:25 -05:00
Ori Livneh
4d23c15a6a Move RunningStat from profiler/ to libs/
There is nothing about the class that mandates it be used exclusively for
profiling, or exclusively within the context of MediaWiki. The functionality it
provides is generic. So move it to libs/ to make it easier to discover & reuse.

Change-Id: Iac8f2f8e1c3231ebe76318d72cf6225e25a7b891
2014-01-02 22:52:37 -08:00
Ori Livneh
681607e55b Add class implementing MessagePack serialization
MessagePack is a space-efficient binary data interchange format. I am going to
use it to encode profiling data in ProfilerSimpleUDP. The official PHP
implementation is provided as a C extension, so using it would further
encumber migration to HHVM. This patch adds MWMessagePack, a class implementing
a pack() method for encoding native PHP values as MessagePack byte strings. The
implementation is based on <https://github.com/onlinecity/msgpack-php>, but
revised for clarity and conformity with MediaWiki coding conventions.

Change-Id: Id2833c5a9da659cb13ec1330de9dd57138ada9c8
2014-01-02 18:04:24 -08:00
jenkins-bot
2fd7a38349 Merge "Add SVG versions of enhanced recent changes collapse/show arrows" 2013-12-27 22:38:54 +00:00
m4tx
3b3042891e Add SVG versions of enhanced recent changes collapse/show arrows
Bug: 35344
Change-Id: I1fcc255691048cb8929a68096e1e0e56e934f020
2013-12-27 23:32:17 +01:00
Aaron Schulz
22af3c78c6 Moved ScopedCallback to /libs
* The MWException is now a standard PHP exception type

Change-Id: I59e3b435cee32efe84c67766e29976b126384389
2013-12-17 10:16:14 -08:00
Bartosz Dziewoński
2c866d8e73 CSSMin: Correctly format 'url()' values with parentheses etc.
Introduce new static function, CSSMin::buildUrlValue.

Actually using such values in CSS does not work well because the
URL_REGEX is nowhere near good enough. :(

Change-Id: I04a7078dd0087bcb461fa5e5168c870d37c255f4
2013-12-11 22:22:59 +01:00
Bartosz Dziewoński
e36dcfa4c6 CSSMin: Change behavior for missing files
We would previously return the path to the local file on the
filesystem, which is useless in all cases and possibly a security
issue in some. Now we return the URL at which the file would be
accessible had it existed.

Also reordered the code around that part to make the control flow
clearer and added a test.

Change-Id: I1d5befb2ea385ae4d316c5d8c5d1fc092b64c4ff
2013-12-11 21:21:36 +01:00
Bartosz Dziewoński
3987b10b51 CSSMin: Fix remapOne() for URLs that are proto-relative or have query part
Bug: 58338
Change-Id: I836a2c054ae3edc07895b2388f4ec8663223347a
2013-12-11 20:58:28 +01:00