* Do not "return true" in hook handlers. I was told it's good practice
to either return false on failure, or nothing/null.
* Remove "static" from method that does not need to be static.
* Make some type hints more specific.
* Add missing imports. I wonder how this can work without the imports.
My PHPStorm complains.
Change-Id: Ia0e980ff99f0e004d700b22dd07ff17f04bed4ec
Fetch the extended metadata for every image, and if the NonFree key
(provided by CommonsMetadata) is present, rank down the image.
The check is run on LinksUpdate so changes to image copyright
templates won't have effect until the page is reparsed.
Unlike other weights, the work of extracting the weight factor from
the file/page is wholly done on LinksUpdate, instead of doing most
of it on parse and storing as ParserOutput extension metadata.
This is to avoid getting the article page parsing and the file
description page parsing conflicting with each other.
Bug: T124225
Change-Id: I21111ecbc80ded864806a2a93002f3254c3c68a9
This patch only moves existing code around, but does not change any
implementation detail.
I found it very suprising that all code called by these two hook handlers
is 100% exclusive to these hook handlers. There is zero interaction
between these hook handlers code and all other code. Why is it in the
same file then? And why is it all static? It doesn't have to be. I
had to change literally nothing, except cutting and pasting, removing
all "static" and replacing all "self::..." with "$this->...". That's
all.
Change-Id: I7fdc582db425d3b95f7d02934b439eb9c102e712
This patch only moves existing code around, but does not change any
implementation detail.
I found it very suprising that all code called by this hook handler
is 100% exclusive to this hook handler. There is zero interaction
between this hook handlers code and all other code. Why is it in the
same file then? And why is it all static? It doesn't have to be. I
had to change literally nothing, except cutting and pasting, removing
all "static" and replacing all "self::..." with "$this->...". That's
all.
Change-Id: I5ffe6fdf4e57135e6f3b32636c80f22be758607c
Titles that correspond to foreign files aren't included in the set of
titles returned by ApiPageSet#getGoodTitles. However, since
ApiQueryPageImages#execute finds files with wfFindFile, these "missing"
titles can be included.
Add the ApiQueryPageImages#getTitles helper function, which returns the
set of "good" titles union the set of missing titles in the File
namespace.
Also, register the PHPUnit tests directory in the UnitTestsList hook
handler.
The original version of this patch was reverted due to a (stupid) bug
wherein a fatal error was triggered because there was no check for there
being no missing titles in the File namespace [0] and, consequently, an
invalid operand was being passed to the array union operator. This bug
is fixed as well as proven to work with a simple set of test cases.
[0] https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FPageImages.git/47137e7ee671c89667d620bc04ac7649b1d9af96/ApiQueryPageImages.php#L31
Bug: T98791
Bug: T114417
Change-Id: I923e88dde3a8ced4921b4192d90b4f3dc4b19e7b
With Ie0ab9090, the OpenSearchXml extension is merged into core. The new
hook works identically to OpenSearchXml's hook.
The $wgPageImagesExpandOpenSearchXml variable should probably be
renamed, but I'm leaving that for a different patch.
Change-Id: I16024aa22578585873cddba1daa4ca0dc05645e1
Adjust them towards larger images, now minimum width not downscored into
oblivion is bumped from 100 to 120 which is the minimum thumb size in
preferences. And the upper limit for maximum score is up from 300 to
400, since the maximum in prefs has grown recently.
Ping vaguely related bug: 72276
Change-Id: Ia81310964d5446833cca11aef1ce9a82f44da991
In it, the extension will accept images from galleries as candidates for
page images.
Core dependency: I3136d648ef2c1841767db0ab33855cd168e3de3e
Bug: 66510
Change-Id: I64e997d58e4a1b66a8a351d85a3e7df1a77354e9