| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Bug: T384879
Change-Id: I439d000515198e43f65a13f8676cadb21ee65d28
(cherry picked from commit 55ad2b22e9b1339f5c0405b5bf4fc1afc0f11952)
|
|
|
|
|
|
| |
Bug: T362829
Change-Id: Ia7c88b3fa51f0a6c515897c535b9969587db81d2
(cherry picked from commit 54b81d8fae2b43cbde5d04bd72d038c4879a3455)
|
|
|
|
|
|
|
| |
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: I73fb416573f5af600e529d224b5beb5d2e3d27d3
|
|
|
|
|
| |
Bug: T360664
Change-Id: I3363a225e54bb2cae01ba066d432a8b7b21933d2
|
|
|
|
|
|
|
|
|
| |
A constant is not a variable. The type is hard-coded via the value
and can never change. While the extra @var probably doesn't hurt much,
it's redundant and error-prone and can't provide any additional
information.
Change-Id: Iee1f36a1905d9b9c6b26d0684b7848571f0c1733
|
|
|
|
| |
Change-Id: Id175a83e71cc910eaee5d5890a9106872a3ca3b8
|
|
|
|
|
|
|
|
|
|
| |
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: I1da4b272a6b28c419cc8e860d142dae19ca0bbcf
|
|
|
|
|
|
|
|
| |
This touches various production classes and maintenance scripts.
The code should do the exact same as before. The main benefit is that
the syntax avoids any repetition.
Change-Id: I5c552125469f4d7fb5b0fe494d198951b05eb35f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
get_debug_type() does the same thing but better (spelling type names
in the same way as in type declarations, and including names of
object classes and resource types). It was added in PHP 8, but the
symfony/polyfill-php80 package provides it while we still support 7.4.
Also remove uses of get_class() and get_resource_type() where the new
method already provides the same information.
For reference:
https://www.php.net/manual/en/function.get-debug-type.php
https://www.php.net/manual/en/function.gettype.php
In this commit I'm only changing code where it looks like the result
is used only for some king of debug, log, or test output. This
probably won't break anything important, but I'm not sure whether
anything might depend on the exact values.
Change-Id: I7c1f0a8f669228643e86f8e511c0e26a2edb2948
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
get_debug_type() does the same thing but better (spelling type names
in the same way as in type declarations, and including names of
object classes and resource types). It was added in PHP 8, but the
symfony/polyfill-php80 package provides it while we still support 7.4.
Also remove uses of get_class() and get_resource_type() where the new
method already provides the same information.
For reference:
https://www.php.net/manual/en/function.get-debug-type.php
https://www.php.net/manual/en/function.gettype.php
To keep this safe and simple to review, I'm only changing cases where
the type is immediately used in an exception message.
Change-Id: I325efcddcb58be63b1592b9c20ac0845393c15e2
|
|
|
|
|
|
|
| |
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: Id9f3e775e143d1a17b6b96812a8230cfba14d9d3
|
|
|
|
|
|
|
|
|
|
|
| |
ImageMagick should not be used if it's not installed. When a custom
convert command is configured, it's the site admin's responsibility
to make sure it works with Webp and XCF files. The php-imagick
extension is just a wrapper for the ImageMagick library, and would
also work for Webp and XCF files.
Bug: T308386
Change-Id: I9fcf22b0c4b6d5d132e5a44530e3f255075f7fb4
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
This patch introduces a new namespace declaration,
MediaWiki\Xml and adds Xml and XmlSelect to it
and establishes class aliases marked as deprecated
since version 1.43.
Bug: T353458
Change-Id: I45cccd540b6e15f267d3ab588a064fbeb719d921
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Remove redundant file-level description and ensure the class desc
and ingroup tag are on the class block instead.
Ref https://gerrit.wikimedia.org/r/q/owner:Krinkle+message:ingroup
Also remove `@group` from `@file` block in MediaHandler.php,
which caused an unhelpful duplicate to be shown in the navigation
on doc.wikimedia.org.
* Create a new "Mime" doc group, and tag all wikimedia/mime classes
with it. Organize it as a subgroup of "Media", matching the way
its tests and other classes relating to handling of media uploads.
* Remove dependency on wikimedia/at-ease per T253461.
Change-Id: If7629db2f33ba8059c5d58d2992488f8f49be373
|
|
|
|
|
|
|
| |
Fixed SkinModuleTest::provideGetFeatureFilePathsOrder as nesting of
arrays for parameters is wrong
Change-Id: I9875008adf62d284c48662ebfbd245d72e5be064
|
|
|
|
|
|
|
|
| |
Bug: T166010
Co-Authored-By: Daimona Eaytoy <daimona.wiki@gmail.com>
Co-Authored-By: James Forrester <jforrester@wikimedia.org>
Co-Authored-By: Subramanya Sastry <ssastry@wikimedia.org>
Change-Id: I79b4e732c45095eedbaa80afa5eb7479b387ed8a
|
|
|
|
|
| |
Follow-Up: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
Change-Id: Iac6aa104331ffc26460f8360b252e03d2307e6fd
|
|
|
|
|
|
|
|
|
|
|
| |
* Switch out raw Exceptions, mostly for InvalidArgumentExceptions.
* Fake exceptions triggered to give Monolog a backtrace are for
some reason "traditionally" RuntimeExceptions, instead, so we
continue to use that pattern in remaining locations.
* Just entirely give up on PostgresResultWrapper's resource vs. object mess.
* Drop now-unneeded false positive hits.
Change-Id: Id183ab60994cd9c6dc80401d4ce4de0ddf2b3da0
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Updating name & email addresses for Brooke Vibber.
Re-ran updateCredits.php as well so there are some new entries in
there as well.
There are a couple of files in resources/libs that will have to
be changed upstream to keep tests happy, I will do patches
later. :D
Change-Id: I2f2e75d3fa42e8cf6de19a8fbb615bac28efcd54
|
|
|
|
|
| |
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
A LogicException is very generic and doesn't mean much. An
InvalidArgumentException is also a LogicException, but more
specific: A method was called (for whatever reason – bad code,
bad user input – we don't know) with an invalid, unsupported
argument. This is exactly what's going on in these cases.
BadMethodCallException does have a confusing name and is often
misused because of this. It's documented as "thrown if a callback
refers to an undefined method or if some arguments are missing".
That's something else and not what's going on in these cases.
Change-Id: Id446227f578ba701e22acd5e530ffb795e76c147
|
|/
|
|
|
|
|
|
|
|
|
| |
Move it to the StringUtils class, and make it throw a dedicated
exception. Update code in media/ to use the new method. Those seemed to
be the only usages across all known MW code [1], so hard-deprecate the
method as well.
[1] - https://codesearch.wmcloud.org/search/?q=wfUnpack&files=&excludeFiles=&repos=
Change-Id: I82ce96b6373443cf57a48b98595ca05290f37349
|
|
|
|
|
|
|
|
| |
Two of the classes in this directory have already namespaced to
MediaWiki\PoolCounter.
Bug: T353458
Change-Id: Ie41f8d935f7623bb40040a5eb78f99c6d7b7b75e
|
|
|
|
|
|
|
|
| |
When symlink fails there is a E_WARNING,
for example about "Permission denied"
Mostly on windows
Change-Id: If450c3ade69cca7dc1130c60a5bb5ee7e669d289
|
|
|
|
|
|
|
|
|
|
| |
For readability. Allowed since PHP 7.4.
I searched for integer literals of 6 or more digits, and also changed
some nearby smaller numbers for consistency.
Bug: T353205
Change-Id: I8518e04889ba8fd52e0f9476a74f8e3e1454b678
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| |/
|/| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On commons wiki there is at least one PNG file with Flash exif
metadata set to empty string ( `exif:Flash=""` ). Every pageview
triggers FormatMetadata::makeFormattedData() throw a PHP warning
as it cannot proceed with bitwise operations between empty string
and integer.
Exif tools recognize this value as "flash not fired", therefore
once we get empty string lets treat that as a 0.
Bug: T350893
Change-Id: Idd7d4a2bbac377d5f6506f5df2c91e4912559c41
|
|/
|
|
|
|
|
|
|
|
|
| |
This change was first introduced in Ic4e3dff and then reverted because
of a regression on CLI. So for now forward-port the code from that patch
and put it under a feature flag we can remove once we've debugged
the current issue.
Bug: T289228
Bug: T352515
Change-Id: Id9539a28f0f143539334002c356026b0d185450b
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
Some of these comments are more than 20 years old. Almost all of them
are copy pasted from somewhere else, most certainly without knowing
what they mean. I can only guess that they have been part of some
ancient code folding feature that's not supported any more. Even if,
almost all of them are misplaced by now because the surrounding code
changed without updating the comments.
Change-Id: I53c37f050574a530ec772b7a07b67d84b31bb7a0
|
|
|
|
|
|
|
|
|
|
|
|
| |
The complexity is really not needed in these cases. strtr() does have
the behavior we want: It does all replacements at the same time instead
of sequentially.
We are also adding test cases for the previously uncovered
StringUtils::escapeRegexReplacement() we rely on in this patch.
Bug: T308395
Change-Id: I6741303775d6d54f3ad0d50635a986ff992ae8f4
|
|
|
|
|
| |
Bug: T166010
Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
empty() only makes sense when the expression it checks is possibly
undefined, otherwise it's equivalent to a truthiness check with the
additional downside of suppressing errors when it's not wanted.
Replace it with simple truthiness checks, using strict comparison when
that seems to help with polymorphic variables.
These were caught by a bespoke phan plugin.
Change-Id: I70b629dbf9e47cf3ba48ff439b18f19e839677f4
|
|
|
|
|
|
|
|
|
|
| |
And namesapce them:
- StreamFile
- OutputHandler
- OutputPage
Bug: T321882
Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
|
|
|
|
|
|
|
|
|
|
| |
This class is used heavily basically everywhere, moving it to Utils
wouldn't make much sense. Also with this change, we can move
StatusValue to MediaWiki\Status as well.
Bug: T321882
Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3
Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
|
|
|
|
|
|
|
| |
Introduce new classes for checked exceptions.
Bug: T328220
Change-Id: Idbcdc09647a857e359e41ecec98212a8937c5c2e
|
|
|
|
|
| |
Bug: T328220
Change-Id: I3c36835fbd90acc301731e2b33ae4815cd4b0cc5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is all in the context of !$enableLegacyMediaDOM where explicit
magnify links aren't added to the html.
If we're linking to the file description page, magnify links are already
added via css. However, if we're not, we're missing both the url for
the media and something to click on, which can't be added with css.
Here we add the necessary url as a resource attribute on the
mw-file-element. Parsoid already does this unconditionally so there's
precedent for it. And, in the common case, there isn't any redundancy
since it will be omitted where mw-file-description links are present.
A script is provided to add the magnify links where needed. These
aren't added directly to the html since they are considered purely
presentational. Though they're styled the same as mw-file-description
links, they are given a different class, mw-file-magnify, to avoid any
confusion about their purpose and the expectation that the media element
would be found inside them.
As above, since the legacy output always includes the magnify links in
the html, it's a significant reduction in size to only be including the
resource attribute where necessary and adding the links via css.
Bug: T329413
Depends-On: Ia22eeef770980fd555fdeb83049fc0ff700be884
Change-Id: Id46d1b2ab1af3baebff13e10f1485f3cfd9a4b37
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
The Hooks class contains deprecated functions and the whole class is
going to get removed, so remove the convenience function and inline the
code.
Bug: T335536
Change-Id: I8ef3468a64a0199996f26ef293543fcacdf2797f
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 42aa5f9481433b5574fc4ff6bd4ea832c24adba0.
Reason for revert: Caused T334753, the proposed fix may need more time for review. Let's revert for now, before the train cut.
Bug: T310453
Bug: T334753
Change-Id: I790604eef00491b7f2a921fb3423a2f727f6593b
|
|
|
|
|
| |
Bug: T310453
Change-Id: I45e495d2c4fc026bdfc54e3219ff7138789d25dd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Inappropriate @inheritDoc usage. Arguably all @inheritDoc is
inappropriate but these are the ones PHPStorm flags as misleading
due to the method not being inherited.
* Doc comment type does not match actual argument/return type.
* I replaced "@return void|never" with "@return void" since never means
never, it doesn't make sense for it to be conditional. If a method
can return (even if that is unlikely) then @return contains the type
that it returns. "@return never" means that there is no such type
because the method never returns.
* Incomplete/partial/broken doc tags
Change-Id: Ide86bd6d2b44387f37d234c2b059d6fbc42ec962
|