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
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
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
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
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
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
* 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
* 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
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
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
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
* 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
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
* 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
* Throw InvalidArgumentException
* Use data provider in unit tests
* Detect associative arrays without copying
Per Tyler's post-merge review of Id2833c5a9.
Change-Id: Iec6b135238ca5da3002944066843102f0ae8d23d
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
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
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
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