Commit graph

31 commits

Author SHA1 Message Date
Reedy d52f94205f Convert PageImages to extension registration
Bug: T87953
Change-Id: Icc9096060899b9e401d53590f38865b0937a73ff
2016-10-16 20:45:54 +01:00
Thiemo Mättig 4fee70fc1f Remove not needed "return true" from hook handlers
* 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
2016-03-07 12:07:06 +01:00
Gergő Tisza 7c78ba622c Weigh images by copyright status
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
2016-03-02 00:59:02 +00:00
Thiemo Mättig 0e8d85a333 Rename class to plural ParserFileProcessingHookHandlers
As discussed in I7fdc582.

Change-Id: I76ffd85323f2b6b8ad4a22ee4671f0bb5a95456d
2016-02-14 12:21:00 +01:00
jenkins-bot 9f09934913 Merge "Extract ParserMakeImageParams/AfterParserFetchFileAndTitle hook handlers" 2016-02-12 17:29:37 +00:00
jenkins-bot 74fde6270d Merge "Extract LinksUpdateHookHandler to separate file" 2016-01-25 18:20:41 +00:00
Thiemo Mättig fe0da50344 Extract ParserMakeImageParams/AfterParserFetchFileAndTitle hook handlers
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
2016-01-18 13:00:21 +01:00
Max Semenik c0ecb9cd0c Add license name to Special:Version
Change-Id: I176dd2bfd34b6a8f1476f78d78a8cd8efa523519
2016-01-12 13:55:31 -08:00
Thiemo Mättig d9df7178a0 Extract LinksUpdateHookHandler to separate file
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
2015-12-30 13:40:48 +01:00
Thiemo Mättig 9b65ac4def Organize code in includes/maintenance directories
Change-Id: I3a243074049a5b8b212de5bcd1e341c36e4a13e0
2015-11-12 08:33:43 +01:00
Sam Smith 56243a6c65 Include foreign files in ApiQueryPageImages
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
2015-10-05 13:24:00 +01:00
Brad Jorsch bccf0c0862 Use new ApiOpenSearchSuggest hook
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
2014-11-05 17:21:06 -05:00
Max Semenik a5819adbc8 Tweak scoring rules
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
2014-10-20 15:01:32 -07:00
Max Semenik 69948bc4ac Add page images to mobile watchlist A-Z view
Needed for I2a92e6bfd76fd41c5efef6988a95dad2d7fae6e1

Change-Id: I6d1d5844fae4a414e9c359a7c12cfe73f62640e3
2014-09-19 11:41:48 -07:00
Max Semenik b8c6fd9325 Introduce gallery mode
In it, the extension will accept images from galleries as candidates for
page images.

Core dependency: I3136d648ef2c1841767db0ab33855cd168e3de3e

Bug: 66510
Change-Id: I64e997d58e4a1b66a8a351d85a3e7df1a77354e9
2014-07-03 17:36:34 -07:00
wctaiwan 587bf22f51 Display page image on action=info
Show the page image as one item under "Basic information" on action=info.

Bug: 64178
Change-Id: Id561c817fdda057c9dd8beae275c3b978b4dd20a
2014-05-05 14:16:39 -07:00
Siebrand Mazeland bddcacf7fb Migrate to JSON i18n
Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I5b344b529252da5c24e261d3cef3acafdbc14bf0
2014-03-28 12:12:22 +01:00
Max Semenik 34437e87da Take ratio into account when considering images
An image might be of a sufficient width but still wildly unsuitable
like https://en.wikipedia.org/wiki/File:Status_iucn3.1_EN.svg

Change-Id: Ib34d8b5cc0b15407ce8cf0caae4df1c63247619b
2014-02-12 22:07:36 +04:00
raymond 32cf6dca61 Fix typo in MediaWiki blacklist message key
Add empty message to i18n file. This way it is shown on Special:AllMessages

Change-Id: If72cd32953c3787398068a9c8a82a386b6f41f02
2012-12-26 22:26:51 +01:00
Max Semenik bd4ddfa90b Throw away everything not needed per our current requirements
Due to vastness of rewrite, recommend whole extension review instead of
reading diffs.

Change-Id: Ia50869d68b8796be9c95d0783f3f7adb71fdc2df
2012-12-21 12:40:47 +04:00
Max Semenik 32bc6cc0d2 Rewrite to support more precise search than just for presence/absence of pics
Pageset 2: fix minor stuff from CR

Change-Id: I6c0fa563a791c5fec82755beb695af74edd6c040
2012-07-20 00:51:16 +04:00
Max Semenik 37521118e1 Let other extensions know that we're installed 2012-03-12 16:54:17 +04:00
Max Semenik c1dcabeee2 Extend OpenSearchXml with image information 2012-03-08 18:01:00 +04:00
Max Semenik 941b84e967 roughly finished 2012-03-06 01:37:06 +04:00
Max Semenik 49d0a775a5 Blacklist functionality 2012-03-02 20:42:17 +04:00
Max Semenik 954d2d4350 extension credits 2012-03-02 00:00:29 +04:00
Max Semenik 703e6ef8a9 API module 2012-03-01 21:37:16 +04:00
Max Semenik 239fb0f521 Code docs 2012-03-01 18:33:28 +04:00
Max Semenik 63361c93c3 Scoring system 2012-03-01 16:25:57 +04:00
Max Semenik 6d258671b5 ++ 2012-02-29 14:50:36 +04:00
Max Semenik fb828b5361 first commit! 2012-02-29 13:30:06 +04:00