| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Bug: T353458
Change-Id: I35864ad9bd48701703c51367d62f8ebde963c52d
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Almost every other media type prefer physicalWidth over width param
except SVG because it wasn't really needed and svg has a dedicated
::makeParamString() function that doesn't call its parent.
This is making steps not work for SVG files.
Locally worked just fine and fixes the issue.
Bug: T360589
Change-Id: Ifcd1693262b64256e310e68d93fc08af5b6e83df
|
|
|
|
| |
Change-Id: Id3f11703cceb0673001b6a17c7c0ca334f8c78ce
|
|
|
|
|
|
|
|
| |
Changes to the use statements and some additions
are done automatically via script
This also updates @covers tag for the namespaced classes
Change-Id: I859ba6d05018c99710b744e2becab432410d3bca
|
|
|
|
|
|
|
|
|
|
|
| |
Implicitly marking parameter $... as nullable is deprecated in php8.4,
the explicit nullable type must be used instead
Created with autofix from Ide15839e98a6229c22584d1c1c88c690982e1d7a
Break one long line in SpecialPage.php
Bug: T376276
Change-Id: I807257b2ba1ab2744ab74d9572c9c3d3ac2a968e
|
|
|
|
| |
Change-Id: I7e5df58fe809d3adb61bdb64444c4ca98641c6c6
|
|\ |
|
| |
| |
| |
| | |
Change-Id: Id7ccd48e3bf626095e2d3929831b5d87ed0be948
|
|/
|
|
|
|
|
|
|
| |
Avoid own teardown as MediaWikiIntegrationTestCase tracks the file and
delete the file on teardown
Remove unused tempnam (added unused in 3db119428a)
Change-Id: Ic53398c89c885f1c263dfcdbc59f6129f605f5a7
|
|
|
|
|
|
|
|
|
|
| |
Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.
Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.
Change-Id: Ifbc2ce0c68865c5d32689e56c6215a5099f7478b
|
|
|
|
|
| |
Bug: T343771
Change-Id: Ib390ffe80ffd62b7f22efe86f6a08108959a970c
|
|
|
|
|
|
|
|
|
| |
This patch introduces a namespace declaration for the
Wikimedia\FileBackend to FileBackend and establishes a class
alias marked as deprecated since version 1.43.
Bug: T353458
Change-Id: Id897687b1d679fd7d179e3a32e617aae10ebff33
|
|
|
|
|
|
|
|
|
|
|
| |
In addition to the webp spec, this also detects two non-standard
conventions sometimes found in real files: Allowing a fourcc
of "XMP\0" instead of the standard "XMP " and allowing the prefix
"Exif\0\0" at the beginning of the EXIF chunk.
Bug: T338341
Bug: T353981
Change-Id: I0ddc3322e1c2f4d4d7bb11732e05fd4ffb5eb692
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Per the SVG2 spec, these units should be interpreted following
CSS units level 3. We had a number of differences:
* Units are supposed to be case-insensitive (previously required lowercase)
* Missing the units q, rem, ch
* ex is supposed to be 0.5em if UA does not know what it is (previously 0.75em)
* Absolute units are supposed to assume 96 dpi (previously was 90dpi)
Additionally the spec mentions the units vw, vh, vmin, vmax which are missing.
Support for those are left as a future TODO.
Bug: T364066
Change-Id: Ie18e4fe38c0ab7f8fc861839783a4758fdb09a8b
|
|
|
|
|
|
|
| |
This also improves ThumbnailEntryPointTest by allowing it
to assert which headers got sent.
Change-Id: I33911775bce1b3cc7a53a03c2be50d53a28fabd1
|
|
|
|
| |
Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
|
|
|
|
|
|
|
|
|
| |
Covered:
- `testMustRender`: Confirmed handler's necessity to render the file.
- `testGetThumbType`: Verified thumb type returned for BMP files.
- `testGetSizeAndMetadata`: Tests with various BMP file sizes.
Change-Id: Ib01914e1ab66ca10ff4e089a0fd591d0b544edf5
|
|
|
|
|
|
|
|
| |
Most (all?) of the remaining usages are caught somewhere and will be
migrated later.
Bug: T328220
Change-Id: I5c36693a5361dd75b4f1e7a0bab5ad48626ed75c
|
|
|
|
|
|
|
| |
Changes to the use statements done automatically via script
Addition of missing use statements and changes to docs done manually
Change-Id: Ib326ae1e5c8409a98398c721e8b8ce42c73bd012
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Following up Id9539a28f0f143539334002c3:
* Don't run the script twice.
* Wrap the decoded dump in an array with key "data".
* The default assignment for DJVU_DUMP and DJVU_TXT had the effect of
running the scripts anyway if the configuration variables are null.
Don't do that.
* If both $wgDjvuDump and $wgDjvuTxt are null, don't run the shellbox
script.
* Centralise shell location configuration.
* Factor out call to convertDumpToJSON().
* Instead of txt_exit_code, just use existence of the file to
communicate success. This avoids a deprecation warning if
txt_exit_code was not received, due to passing null to trim.
* Check for the existence of the result files instead of just trying to
use them.
* Check the exit status of the overall script.
* Confirm that the BoxedCommand branch is functional and works in CLI
mode by using it in DjvuTest.
* Change the service name from "media" to "djvu". Existing examples are
"pagedtiffhandler" and "pdfhandler", i.e. named after the extension,
there is no other core caller. I think it should be more fine-grained
than "media". The name was possibly a conflation with the
ProductionServices array key.
Also:
* Check the exit status of djvudump and don't use the output file if it
is non-zero.
* Check the return value of convertDumpToJSON().
* Don't use isset() unless error suppression is intended.
Bug: T352515
Change-Id: If41a2baada2e4e2462518c1f437af458feb29632
|
|
|
|
|
|
|
|
|
|
|
|
| |
This does a string check on animated and @keyframe in style elements
for SVGs. If there is a match it will treat this SVG as animated.
While in theory this could be a false positive, without fulling
parsing the CSS, the chances of that seem minor and there are no
real negative consequences either.
Bug: T332790
Change-Id: I4b8b0781e8f9135d9ab856f3ec06f5a76c66c9a8
|
|
|
|
|
|
|
|
|
|
|
| |
This was done automatically using the
`Universal.WhiteSpace.CommaSpacing` sniff, which will be included in the
next release of the MW PHPCS config.
Some of these have been adjusted manually where the autofix broke
vertical alignment.
Change-Id: I54a4668d8a2759b9d7de47742c943a535a04e211
|
|
|
|
|
|
|
|
|
|
| |
… or with $this->fail() from the PHPUnit TestCase base class.
I hope this makes the code more readable, i.e. communicate the
intention better. The output should be the same, i.e. the test fails
as before in case of an error.
Change-Id: Ied8a045141ac92d6af6398682bb5d9ca7ca88c49
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Down from about 1000ms to 200ms. By using much smaller images. The
absolute size of the images is not relevant for this test. Only the
ratio.
There was nothing special about the "landscape-plain.jpg" image. But
"portrait-rotated.jpg" was: It's technically stored in landscape, but
marked with an EXIF tag for rotation. I used exiftool to copy the EXIF
data to the smaller version, so it behaves the same as before.
Change-Id: Ie977dfbceff02e4dfde38a5ef82e8ff81b4d6980
|
|
|
|
|
|
|
|
|
|
| |
Same as I7a82951.
overrideConfigValue() and overrideConfigValues() both call
setMwGlobals(), which calls resetServices(). This is surprisingly
expensive. It's much better to call it once with an array.
Change-Id: I4ff2f6b902b1a1e0b554ce6fc76f3b612f703fae
|
|
|
|
|
|
|
| |
Introduce new classes for checked exceptions.
Bug: T328220
Change-Id: Idbcdc09647a857e359e41ecec98212a8937c5c2e
|
|
|
|
|
|
|
| |
Use SPL exceptions instead when the exception is unchecked.
Bug: T328220
Change-Id: Ia1e5edc2ef3269a44b670262b78b305d07559829
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add wgSVGNativeRendering to allow clientside rendering of SVG files
Default is false. When enabled with true, will serve ALL SVG files
as is to the browser.
When set to the string 'partial' it will conditionally serve SVG
files based on criteria. Currently it will force PNG rasterization
for translated SVGs and for SVGs over wgSVGNativeRenderingSizeLimit
wgSVGNativeRenderingSizeLimit is a byte size limit to avoid larger
SVG files (potentially much bigger than a PNG) from being served
directly to browser.
Native SVG rendering does not provide PNG fallback. SVG support in
browsers has evolved far enough that this should rarely be a problem.
Bug: T208578
Change-Id: I9647fdd72f868c821eb20f67b239826f23655a1c
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Unnecessary regex modifier. I agree with this inspection which flags
/s modifiers on regexes that don't use a dot.
* Property declared dynamically.
* Unused local variable. But it's acceptable for an unused local
variable to take the return value of a method under test, when it is
being tested for its side-effects. And it's acceptable for an unused
local variable to document unused list expansion elements, or the
nature of array keys in a foreach.
Change-Id: I067b5b45dd1138c00e7269b66d3d1385f202fe7f
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just methods where adding "static" to the declaration was enough, I
didn't do anything with providers that used $this.
Initially by search and replace. There were many mistakes which I
found mostly by running the PHPStorm inspection which searches for
$this usage in a static method. Later I used the PHPStorm "make static"
action which avoids the more obvious mistakes.
Bug: T332865
Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
|
|
|
|
|
|
|
| |
And WikiReference
Bug: T321882
Change-Id: I60cf4b9ef02b9d58118caa39172677ddfe03d787
|
|
|
|
|
|
|
|
|
| |
- Declare missing properties
- Remove unused or avoid set of properties
- Add AllowDynamicProperties
Bug: T314099
Change-Id: Ie631894f2ffbb616f6dd09851405d681f3eb8fcd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PHPUnit 3.7.0 was the first version to support @requires extension. At
the time checkPHPExtension() was added in a7901801b4cba6e5, MediaWiki
still supported PHPUnit 3.6.7.
MediaWiki now requires intl and xml, so I removed checks for those
extensions rather than converting them to annotations.
checkPHPExtension() is removed without deprecation; it does not appear
to have ever been used (and is not likely to be used) in MW extensions.
This is explicitly permitted under the stable interface policy. Even if
it were not, only tests are affected, and they are supposed to fail
anyway if hard deprecated code is used.
Change-Id: I45f9b4c0e120683103cead916f4d4ef58bd11530
|
|
|
|
| |
Change-Id: I49d97864d8f9d8cadf01b0c0dc653fbac4ca9e94
|
|
|
|
| |
Change-Id: Ic748489309a1c8ff0f916b3f55aacc93ca128ea3
|
|
|
|
|
|
| |
Remove dead code and fix typos. Should cause no change in behavior.
Change-Id: I5d293b842bc93a28b8bcd799a31b5e6e30fe692e
|
|
|
|
|
|
|
|
|
|
|
| |
This adds support for languages that the SVG uses but that MediaWiki
does not support. It might not be able to find the correct
languagename for that language code, specifically for als.
Add some paramString parsing testcases
Bug: T279874
Change-Id: Id8a62e2a9c5e1565f173b1bba466306741b62762
|
|
|
|
|
|
|
|
|
|
|
| |
There is a common and reasonable need for longer lines in tests.
The nudge for shorter lines doesn't seem valuable here. The natural
breaks will likely still fall in 80-100 given the enforced practice
for non-test code, e.g. whether through habit, or 80-100 column markers
in text editors, or the finite width of diff and code review
interfaces.
Change-Id: I879479e13551789a67624ce66f0946d2f185e6ee
|
|
|
|
|
|
|
|
|
|
|
|
| |
Expected value is the first parameter to assertSame() or assertEquals().
And turn to use assertCount() for some assertions aginst count of array.
Based on code search `assert(?:Same|Equals)\(.+,.+expected` and I look
through files roughly, so some assertions that don't contains 'expected'
are also fixed. In the meantime, some assertions that I am not clear
about are not touched.
Change-Id: I75798b60d29fd19b33f4fdf34ed3c788db420d01
|
|
|
|
| |
Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
|
|
|
|
|
|
|
|
| |
The global function wfWikiID() is deprecated since 1.35 and it's usages
should be replaced with WikiMap::getCurrentWikiId().
Bug: T298059
Change-Id: I22d96b7aec17323d15a9bc401d4511ad2ee14165
|
|
|
|
|
|
|
|
|
|
| |
It has to keep backward compatibility for loading metadata.
Tested locally and works fine.
Bug: T275268
Bug: T192866
Change-Id: Ied61736e329e0e0f37b1db35bd3f7a4b343c01a2
|
|
|
|
|
| |
Bug: T286273
Change-Id: Iceaf92647e74a1e20f94fc36822d0735f70764dc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
The following sniffs now pass and were enabled:
* Generic.ControlStructures.InlineControlStructure
* MediaWiki.PHPUnit.AssertCount.NotUsed
npm:
* svgo: 2.3.0 → 2.3.1
* https://npmjs.com/advisories/1754 (CVE-2021-33587)
Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Factor out file read errors and unexpected EOF errors.
* For errors relating to chunk content, instead of throwing an
exception which is silently discarded, just log an error and continue
to the next chunk. This allows the dimensions to be extracted even if
other metadata is mangled.
* As an additional sanity check, verify the CRC of each chunk.
Bug: T286273
Change-Id: I11d0186496324e0bb1bb0a143f438e0368a8e902
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Image metadata is usually a serialized string representing an array.
Passing the string around internally and having everything unserialize
it is an awkward convention.
Also, many image handlers were reading the file twice: once for
getMetadata() and again for getImageSize(). Often getMetadata()
would actually read the width and height and then throw it away.
So, in filerepo:
* Add File::getMetadataItem(), which promises to allow partial
loading of metadata per my proposal on T275268 in a future commit.
* Add File::getMetadataArray(), which returns the unserialized array.
Some file handlers were returning non-serializable strings from
getMetadata(), so I gave them a legacy array form ['_error' => ...]
* Changed MWFileProps to return the array form of metadata.
* Deprecate the weird File::getImageSize(). It was apparently not
called by anything, but was overridden by UnregisteredLocalFile.
* Wrap serialize/unserialize with File::getMetadataForDb() and
File::loadMetadataFromDb() in preparation for T275268.
In MediaHandler:
* Merged MediaHandler::getImageSize() and MediaHandler::getMetadata()
into getSizeAndMetadata(). Deprecated the old methods.
* Instead of isMetadataValid() we now have isFileMetadataValid(), which
only gets a File object, so it can decide what data it needs to load.
* Simplified getPageDimensions() by having it return false for non-paged
media. It was not called in that case, but was implemented anyway.
In specific handlers:
* Rename DjVuHandler::getUnserializedMetadata() and
extractTreesFromMetadata() for clarity. "Metadata" in these function
names meant an XML string.
* Updated DjVuImage::getImageSize() to provide image sizes in the new
style.
* In ExifBitmapHandler, getRotationForExif() now takes just the
Orientation tag, rather than a serialized string. Also renamed for
clarity.
* In GIFMetadataExtractor, return the width, height and bits per channel
instead of throwing them away. There was some conflation in
decodeBPP() which I picked apart. Refer to GIF89a section 18.
* In JpegMetadataExtractor, process the SOF0/SOF2 segment to extract
bits per channel, width, height and components (channel count). This
is essentially a port of PHP's getimagesize(), so should be bugwards
compatible.
* In PNGMetadataExtractor, return the width and height, which were
previously assigned to unused local variables. I verified the
implementation by referring to the specification.
* In SvgHandler, retain the version validation from unpackMetadata(),
but rename the function since it now takes an array as input.
In tests:
* In ExifBitmapTest, refactored some tests by using a provider.
* In GIFHandlerTest and PNGHandlerTest, I removed the tests in which
getMetadata() returns null, since it doesn't make sense when ported to
getMetadataArray(). I added tests for empty arrays instead.
* In tests, I retained serialization of input data since I figure it's
useful to confirm that existing database rows will continue to be read
correctly. I removed serialization of expected values, replacing them
with plain data.
* In tests, I replaced access to private class constants like
BROKEN_FILE with string literals, since stability is essential. If
the class constant changes, the test should fail.
Elsewhere:
* In maintenance/refreshImageMetadata.php, I removed the check for
shrinking image metadata, since it's not easy to implement and is
not future compatible. Image metadata is expected to shrink in
future.
Bug: T275268
Change-Id: I039785d5b6439d71dcc21dcb972177dba5c3a67d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basic handler for JPEG2000 files. Both jp2 and jpx are supported by
php's image functions.
No support for:
- metadata
- lossy vs lossless thumbnail
- bucketing
- thumbor
Bug: T161934
Change-Id: I1a72d4dfb034f3ae24661db515cf03b35ec18fa2
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ended up using
grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g'
special-casing setMethods( null ) -> onlyMethods( [] )
and then manual fix of failing test (from PS2 onwards).
Bug: T278010
Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The control characters are presented as text, not actual
control characters, so the regexes to replace them are
incorrect.
Added a column and para to the Djvu text on the first page
of the test LoremIpsum.djvu file
Bug: T230415
Change-Id: I4970bc30b3935ce4da062ee7ff687aa667027a00
|