Commit graph

21 commits

Author SHA1 Message Date
Andre Klapper 871cb29005 Use explicit nullable type on parameter arguments (for PHP 8.4)
Implicitly marking parameter $... as nullable is deprecated in PHP
8.4. The explicit nullable type must be used instead.

Bug: T376276
Change-Id: I2f17c7e8c6365795f7a54738b0e607b6f35c9df2
2024-10-26 15:09:27 +02:00
Umherirrender 09d47340eb Use the expression assignment operator to simplify code
Suggested by phan, available since php7.4

Change-Id: Iadee84c7b62f9aeac31ade702bc33764d35ef9c8
2023-10-14 00:55:37 +02:00
Umherirrender ec4d1bed4d Use namespaced MediaWiki\Page\PageProps
Bug: T321681
Change-Id: I5298c09e2869a21e6616cb6e8917da51177c7987
2023-08-20 01:21:38 +02:00
Matthias Mullie c75b00d14d Ensure array is passed to getProperties
PageImages::getPropNames can return either array or string,
and PageProps::getProperties accepts both.
But the latter's return value will be different depending
on the type of input: with an array as input, the returned
array's values will be an associative array where the index
is the propname; with a string, it's just the propvalue.

This difference matters because the code below assumes an
array with propname keys.

Bug: T323152
Change-Id: I422951ec0cd5c651b32c65e88a557d49f2f22712
2022-11-16 09:33:37 +01:00
Matthias Mullie 5dcd4d13e2 Only provide free images for search purposes
Bug: T320661
Change-Id: Ic26e7e815365f6aa81b6fbfb464d0f41b80e4ae8
2022-11-10 13:26:56 +01:00
Matthias Mullie 6a6af45ab3 Drop some code that now lives in core
The default thumbnail size (SearchResultThumbnailProvider::THUMBNAIL_SIZE),
the code to build a SearchResultThumbnail object from a File object
(SearchResultThumbnailProvider::buildSearchResultThumbnailFromFile),
and the code that provides thumbnails from NS_FILE pages (now already
provided in the hook's $results param) have essentially been adopted
in core and no longer need to be handled here.

Also updated test to reflect that NS_FILE results will no longer be
provided by this extension (since core already provides them)

Depends-On: I2a679b51758020d3e822da01a1bde1ae632b0b0a
Change-Id: I2eafc8556022432929973755d8cd76010ea24f39
Bug: T306883
2022-09-27 10:46:14 +02:00
Matthias Mullie 2d95a2be65 Update hook FQCN
This hook has moved.

Depends-On: Ic9110345b4db69d268685b80ec8e4e33da95a050
Change-Id: I71bddf3978a5b6124bdd114fcb74fbabe607a64a
Bug: T306883
2022-09-01 14:39:37 +02:00
Matthias Mullie a8c8030299 Allow thumbnails to be provided in a different size
This will also be added to the interface, but first this
implementation needs to be updated to already accept the
optional new param. Doing it in different order would
cause incompatible declaration warnings.

Bug: T306883
Change-Id: Ia30afcc43a0ecec772cd0a82dd9661e61f31a651
2022-09-01 12:29:41 +00:00
Kosta Harlan 8adbbf5b8c
SearchResultProvideThumbnailHookHandler: Simplify code
Bug: T312746
Change-Id: Iaf3f7f56129f488088f08f65657fa33f6a6e5851
2022-07-18 10:13:42 +02:00
Kosta Harlan c7054f15c6
SearchResultProvideThumbnailHookHandler: Construct from injected services
Bug: T312746
Change-Id: I0ed66f69a4ae9350b2230b5e207a76bbcf5bb689
2022-07-11 15:12:17 +02:00
Reedy 84861174bc Convert Hooks to HookHandlers
Bug: T271021
Change-Id: I6022e515cf65ec089c59fb56f6fde371dc9f0e12
2022-07-07 10:21:43 +00:00
Umherirrender 23c44e9f7d doc: Cleanup @param documentation
No extra sign needed between variable and description

Change-Id: I6cf199a7e3e295d45bf95981166a23119afb41ac
2021-11-04 22:19:59 +01:00
Alexander Vorwerk 73371eb33e Replace usage of deprecated PageProps::getInstance()
Bug: T289544
Change-Id: Ie30d3d2339ebf110a9827c3fa5cd604928abfd38
2021-09-26 14:40:10 +02:00
Kunal Mehta 7e13212a7c Check $thumb->isError() before trying to use it
$thumb might be an instance of MediaTransformError, which as the name
implies, is not really usable as a thumbnail and should be skipped
instead.

Bug: T290973
Change-Id: Ie818bd295bfe06c7c0dc0a2ea7dd273c7e0e416f
2021-09-14 09:56:05 -07:00
Petr Pchelko a0d2696e69 Remove leftover SearchResultPageIdentity typehints
Change-Id: I7a1dfc26d0985e645c785297c849e4c2854c034b
2021-05-14 19:21:16 -07:00
libraryupgrader 668d044574 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

npm:
* grunt: 1.3.0 → 1.4.0
* lodash: 4.17.19 → 4.17.21
  * https://npmjs.com/advisories/1673 (CVE-2021-23337)

Change-Id: I6797ecfc38973777657d1d4611363595b23e4afd
2021-05-12 19:05:01 +00:00
Thiemo Kreuz d8eceed585 Update PHPDocs and use PHP7 features where possible
Change-Id: I417ad041e268b88512de435c59695cb4338331cc
2021-05-04 16:51:18 +02:00
lens0021 b4f1051c1d Thumbnail is too hard to type
Change-Id: I04b4f4fab359705df6f9d0d8439743fb2f26b3c5
2020-07-07 16:45:18 +09:00
DannyS712 a135c78cca Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: Icfccaa7795cd672c4f484377a33f7f62e37a7ffb
2020-05-19 23:27:50 +00:00
Peter Ovchyn 6e004092ca rest: Verify that file exists before calling filesize
Bug: T252128
Change-Id: I2de87d723fdd99bea0f1dadd23648470759a103e
2020-05-07 19:33:49 +03:00
Peter Ovchyn 34f54dd1ad rest: Implement SearchResultProvideThumbnail hook
SearchResultProvideThumbnail was introduced in T250144. In order to fill
search results with the "thumbnails" field it should be implemented in proper extension.

Bug: T250207
Change-Id: I81d5d70f5237d6399b8ec6bec3058d12e40ca142
2020-05-06 22:52:49 +03:00