aboutsummaryrefslogtreecommitdiffstats
path: root/includes/media
Commit message (Collapse)AuthorAgeFilesLines
...
* | Hard deprecate FormatMetadata::flattenArrayContentLangMatěj Suchánek2022-07-081-4/+2
| | | | | | | | | | | | It has been deprecated since 1.36 and it is unused. Change-Id: I316333f55526116e9510e4719fce2a93e7683ea6
* | Merge "FormatMetadata: PHP Notice: Array to string conversion"jenkins-bot2022-07-051-0/+6
|\ \
| * | FormatMetadata: PHP Notice: Array to string conversionMark Shenouda2022-07-051-0/+6
| | | | | | | | | | | | | | | | | | | | | [x] Logging more data when it happens again Bug: T297403 Change-Id: I4bf2f4204e990b2869c497ffd3a79af7cde34434
* | | Allow any SVG language tag that is well formed IETFDerk-Jan Hartman2022-06-122-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Support requesting undetermined SVG languageDerk-Jan Hartman2022-06-122-7/+14
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | The default for multilanguage SVGs is the content language. In order to show element with no explicit language, you have to request the 'und' aka undetermined language. Because this was not special cased, this was not accessible and would always fallback to English. Make the default language code a const. Bug: T310235 Change-Id: I6941f46d176ddf3dc811b29d580b1c5b8856eb1c
* / Improve ImagePage::doRenderLangOpt/File::getMatchedLanguageUmherirrender2022-06-092-2/+2
|/ | | | | | | | | | | | | | | | File::getMatchedLanguage does not produce any useful return with null, because the implementation in SvgHandler::getMatchedLanguage returns null as well, null never matched with anything using strcasecmp Bypass the call if no language is requested and adjust the documentation This also avoids passing null to internal functions, which gets deprecated in newer php Bug: T309426 Bug: T289926 Follow-Up: I1d8ec00a0040c7cbebe705012ca99f1e9f613e7f Change-Id: I028b519de20dafad7a872c79343e76991ef544d0
* parser: Remove Priority Hints experiment for thumbnailsmainframe982022-05-191-17/+0
| | | | | | | | | Both this feature and the web standard are experimental. The standard was only exposed as a Google Chrome Origin Trial and the standard has evolved in a non-compatible way. Bug: T308707 Change-Id: I987c0fb9e3fbb1a9f727b3f171c747246d8adb77
* parser: Remove Element Timing experiment for thumbnailsmainframe982022-05-181-11/+0
| | | | | | | | This feature was experimental, unsupported and untested. It was disabled by default. Bug: T308621 Change-Id: I9375f35d031f635af0d39ee0bc027ac719899d9d
* Clarify tooltips are set if captions aren't visibleArlo Breault2022-05-162-3/+8
| | | | | | | | | Matches Parsoid commit Icbc36b6e9aa1b9f4f27c23f4833c626a725cc154 Bug: T297443 Bug: T108380 Depends-On: I896e2af2e8a712a36eb23a25cad08f53574fc044 Change-Id: I30eba0fb226971ddeda4eb240929e89ef7e5f45f
* Merge "Treat file |link= options like wikilinks in terms of title attributes"jenkins-bot2022-05-101-1/+1
|\
| * Treat file |link= options like wikilinks in terms of title attributesArlo Breault2022-05-101-1/+1
| | | | | | | | | | | | Wikilinks don't include the anchor, so we match that. Change-Id: Icddc1ce6f19c21e34ca37f35a75a7b9263f93417
* | Merge "Use copy if symlink fails"jenkins-bot2022-04-301-0/+4
|\ \ | |/ |/|
| * Use copy if symlink failsMark A. Hershberger2022-04-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Symlinks are lightweight and ideal, but some systems may not allow them. Instead of failing outright, an attempt should be made to copy the file and, only if that also fails, declare that the thumbnail creation has failed. Bug: T227157 Change-Id: I50765ab125d775b9ef77613776f8d58da459c496
* | Use MainConfigNames instead of string literals, #4Aryeh Gregor2022-04-2613-52/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now largely automated: VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \ tr "\n" '|' | sed "s/|$/\n/;s/'//g") sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \ $(grep -ERIl "'($VARS)'" includes/) Then git add -p with lots of error-prone manual checking. Then semi-manually add all the necessary "use" lines: vim $(grep -L 'use MediaWiki\\MainConfigNames;' \ $(git diff --cached --name-only --diff-filter=M HEAD^)) I didn't bother fixing lines that were over 100 characters unless they were over 120 and triggered phpcs. Bug: T305805 Change-Id: I74e0ab511abecb276717ad4276a124760a268147
* | language: Add comment about some used messagesUmherirrender2022-04-141-0/+2
| | | | | | | | Change-Id: I7f5598add628d218a000a7da4a1cbb4c0cc2f31b
* | Merge "media: Improve documentation on Handler functions"jenkins-bot2022-04-1111-27/+30
|\ \
| * | media: Improve documentation on Handler functionsUmherirrender2022-03-2911-27/+30
| | | | | | | | | | | | | | | | | | Add missing @return and use false instead of bool where possible Change-Id: Ie85a40987422e32aa02c56969e103371ec2e5b5f
* | | phan: Use @phan-assert on ImageHandler::normaliseParamsUmherirrender2022-04-023-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | Allow phan to assume that some array keys are always set after call to normaliseParams to avoid phan suppression Follow-Up: I701f12ab94478c3b8e7fd82110ade74a8e6b04ef Change-Id: I8d14e49340d30c56642422cd88169019dd2c4286
* | | phan: Remove PhanPossiblyUndeclaredVariable suppressionUmherirrender2022-03-301-0/+1
|/ / | | | | | | | | | | | | | | | | Make phan stricter about conditional variable declaration Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T259172 Change-Id: I1f200ac37df7448453688bf464a8250c97313e5d
* | Merge "phan: Upgrade mediawiki-phan-config to 0.11.1 and set ↵jenkins-bot2022-03-291-1/+2
|\ \ | | | | | | | | | minimum_target_php_version"
| * | phan: Upgrade mediawiki-phan-config to 0.11.1 and set minimum_target_php_versionJames D. Forrester2022-03-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MediaWiki still supports PHP 7.2+, but we want to mainly test in newer versions of PHP. Setting minimum_target_php_version to 7.2 this lets us run phan without phan trying to get us to make PHP 7.2-incompatible changes to 'appease' PHP 8.0 or whatever later changes. Some switches of generic 'resource' type-hinting to 'resource|object' to inform phan to ignore this (triggering PHPCS at the time, ah well), rather than trying to hint the specific novel PHP encapsulation classes to that have replaced them from PHP 8.0 onwards but don't yet exist, and fixes from where we were checking the results of implode and explode. Bug: T293924 Change-Id: I629e3fb3adfad73beb3d424a07e643c2e079d9bb
* | | phan: Remove PhanTypePossiblyInvalidDimOffset suppressionUmherirrender2022-03-284-0/+8
|/ / | | | | | | | | | | | | | | | | | | | | Make phan stricter about array keys Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T304887 Depends-On: I3105a5fd4826f8667b5232834defc5ec93be32a1 Depends-On: Ie9610a6e83731468311edb3ed17f80fc509de385 Change-Id: I701f12ab94478c3b8e7fd82110ade74a8e6b04ef
* | phan: Disable null_casts_as_any_type settingUmherirrender2022-03-212-0/+3
| | | | | | | | | | | | | | | | | | | | | | Make phan stricter about null types by setting null_casts_as_any_type to false (the default in mediawiki-phan-config) Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T242536 Bug: T301991 Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
* | phan: Disable scalar_implicit_cast settingUmherirrender2022-03-181-0/+1
| | | | | | | | | | | | | | | | | | Make phan stricter about scalar types by setting scalar_implicit_cast to false (the default in mediawiki-phan-config) Bug: T242536 Bug: T301991 Change-Id: Ia2fe30b17804186571722e728578121c8b75d455
* | Merge "media: Limit result array of explode() to minimum needed"jenkins-bot2022-03-184-10/+10
|\ \
| * | media: Limit result array of explode() to minimum neededUmherirrender2022-03-014-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | Limit the array for the input to the expected size (or one bigger). This avoids big arrays on bad input and allows to process with the expected values in the array. Change-Id: Iec1a85c29d928966c14cc0273b1a251dc0b6b738
* | | Merge "media: Document version as string on Handler::convertMetadataVersion"jenkins-bot2022-03-142-2/+2
|\ \ \
| * | | media: Document version as string on Handler::convertMetadataVersionUmherirrender2022-03-052-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | See also MediaHandler::getMetadataVersion Change-Id: I6186439c05b5770d9b317ac7b37df116a5d06cbc
* | | | Fix various real types related to scalar typesUmherirrender2022-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Swap null/false or use real strings if needed Found by phan strict checks Change-Id: Id82ea609f05a76c5cb8c661d5cf2b7922d6cfbc1
* | | | Merge "Fix various documentation related to null types (part II)"jenkins-bot2022-03-095-5/+5
|\ \ \ \
| * | | | Fix various documentation related to null types (part II)Umherirrender2022-03-085-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The functions returning null or the class property is set explict null. Some function should not accept null or return null. Found by phan strict checks Change-Id: Ie50f23249282cdb18caa332f562a3945a58d86ff
* | | | | Merge "Add various fallback values for null return values"jenkins-bot2022-03-091-3/+3
|\ \ \ \ \
| * | | | | Add various fallback values for null return valuesUmherirrender2022-03-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by phan strict checks Change-Id: I83187b5fd25b015d2c75e22d4b5202803653d743
* | | | | | Fix various documentation related to scalar typesUmherirrender2022-03-094-5/+5
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | Found by phan strict checks Change-Id: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
* | / / / Fix type of value directly passed to php internal functionsUmherirrender2022-03-071-1/+1
| |/ / / |/| | | | | | | | | | | | | | | | | | | Found by phan strict checks Change-Id: Icc44cd143f2e98fa3ca188e625a3289441de0f73
* | | | Fix various documentation related to falseUmherirrender2022-03-032-2/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | Some function already document "False on failure", but does not document it on the used type Found by phan strict checks Change-Id: I12eb8bbc99179833ee3e42c1a7d1dc1443682ca6
* | | Merge "Add mw-file-description class on links to the file description page"jenkins-bot2022-03-011-0/+2
|\ \ \ | |/ / |/| |
| * | Add mw-file-description class on links to the file description pageArlo Breault2022-03-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Matches Parsoid output. Bug: T292657 Depends-On: Iccee2dcbc7b06d80bcb4e026eedc11042585550b Change-Id: I206f1ccbfee1a601f3e5a4b52cb6acb5a6fbf113
* | | Add explicit casts between scalar typesUmherirrender2022-03-017-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Some functions accept only string, cast ints and floats to string * After preg_matches or explode() casts numbers to int to do maths * Cast unix timestamps to int to do maths * Cast return values from timestamp format function to int * Cast bitwise operator to bool when needed as bool * php internal functions like floor/round/ceil documented to return float, most cases the result is used as int, added casts Found by phan strict checks Change-Id: Icb2de32107f43817acc45fe296fb77acf65c1786
* | | Filter out "LocationShown" from image metadataSimone This Dot2022-02-251-0/+5
|/ / | | | | | | Bug: T297403 Change-Id: I89daeeb24bda37c33ad58177bfc8fbe469f20540
* | Replace some more usages of Wikimedia\(suppress|restore)Warnings()Reedy2022-02-249-28/+42
| | | | | | | | Change-Id: I2eb133a9e32116cd155f59086245bc4d15ecbfcc
* | Revert "Add "resource" attribute to img tags"Arlo Breault2022-02-181-15/+5
| | | | | | | | | | | | | | | | | | This reverts commit 5809ef7caa512b9ad6efa747c88620484c36446d. Bug: T292657 Bug: T297984 Depends-On: I261887a3b2d15130894b947d18a2e85537d50a1f Change-Id: Id4e8d16344ce0f420bfd3e0d5833c67d1cf85fd8
* | Use link-title for manualthumbArlo Breault2022-02-181-1/+2
| | | | | | | | | | | | | | link-url for external links, which this isn't and which gain rel attributes in the follow up. Change-Id: I968dbb72731b9588fad0fa1e7770c799c0e451a5
* | Fix doc for custom-target-linkArlo Breault2022-02-171-1/+1
| | | | | | | | | | | | | | An aside, this is poorly named, custom-link-target would be less confusing with the other -link postfix options, which affect the href. Change-Id: Ib8c5bdcc0cc8732990f55e30e77c865496c74ee1
* | ImagickExt: Set svg background color before importing SVGDerk-Jan Hartman2022-02-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The order of applying the different operations matters in Imagick. We should set the background before adding the SVG, or the transparency will get lost. This is also mentioned in a comment of https://www.php.net/manual/en/imagick.setbackgroundcolor.php Fix thanks to User:TheAlmightyGuru Bug: T301242 Change-Id: Idf8e4da6bfae149b3bd2be04a0ae490122173215
* | Merge "Try not to discard Excimer timeout exceptions"jenkins-bot2022-02-033-1/+7
|\ \
| * | Try not to discard Excimer timeout exceptionsTim Starling2022-02-023-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't catch and discard exceptions from the RequestTimeout library, except when the exception is properly handled and the code seems to be trying to wrap things up. In most cases the exception is rethrown. Ideally it should instead be done by narrowing the catch, and this was feasible in a few cases. But sometimes the exception being caught is an instance of the base class (notably DateTime::__construct()). Often Exception is the root of the hierarchy of exceptions being thrown and so is the obvious catch-all. Notes on specific callers: * In the case of ResourceLoader::respond(), exceptions were caught for API correctness, but processing continued. I added an outer try block for timeout handling so that termination would be more prompt. * In LCStoreCDB the Exception being caught was Cdb\Exception not \Exception. I added an alias to avoid confusion. * In ImageGallery I added a special exception class. * In Message::__toString() the rationale for catching disappears in PHP 7.4.0+, so I added a PHP version check. * In PoolCounterRedis, let the shutdown function do its thing, but rethrow the exception for logging. Change-Id: I4c3770b9efc76a1ce42ed9f59329c36de04d657c
* | | Add timestamp to thumbnail URLs on file pagesAntiCompositeNumber2022-01-251-1/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When overwriting a file, the browser will sometimes display a cached old version of the file instead of the new version. This is because the URLs for the current version of a file (and thumbnails) are not versioned. This patch adds the timestamp as a query parameter to the end of the file URLs. Only the src and srcset URLs will have the timestamp, the links to the original and thumbnails are not versioned. The current version in the file history also gets the timestamp. Previous versions already have a timestamp in the URL. This timestamp is only used for client-side cache busting, it is not interpreted server-side. On WMF sites it will be stripped out by the caching layer anyway. Bug: T38380 Change-Id: Ia63bd96a02d1aa36265742c4307f5af2e675b3ec
* | Merge "Suppress deprecation warnings from libxml_disable_entity_loader()"jenkins-bot2022-01-211-2/+3
|\ \
| * | Suppress deprecation warnings from libxml_disable_entity_loader()Tim Starling2022-01-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in the task, there is no simple replacement for this function. Reduces core PHPUnit error count from 121 to 2. Bug: T268847 Change-Id: Ia8697e1c3ba369346b39ef50d94ea8b132eb9c80