Commit graph

198 commits

Author SHA1 Message Date
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
Translation updater bot 8e9c6fbade Localisation updates from https://translatewiki.net.
Change-Id: I596741985b213b92be14b423744cc55a283046d9
2016-02-19 22:10:02 +01: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
Translation updater bot 1bf982fde1 Localisation updates from https://translatewiki.net.
Change-Id: I67072f1e8a99c44320d7506a8bb7640c5c178f56
2016-02-03 23:08:00 +01:00
Kunal Mehta 59afdff5d5 Don't pass default pref as fallback to User::getOption()
User::getOption() already handles that, and this code bypassed the hook
in User::getDefaultOptions().

Change-Id: I41f9df177988dffd62de0060cb691a97161729e4
2016-01-26 10:07:39 -08:00
jenkins-bot 74fde6270d Merge "Extract LinksUpdateHookHandler to separate file" 2016-01-25 18:20:41 +00:00
Translation updater bot 091012621b Localisation updates from https://translatewiki.net.
Change-Id: I806bb6c0b77019a4c9934c1d15209bc4e80fe37c
2016-01-18 21:36:58 +01: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
Translation updater bot cb184e1349 Localisation updates from https://translatewiki.net.
Change-Id: I50619e480ee1849f46a79f359154233d320d906d
2016-01-17 22:33:41 +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
Kunal Mehta 7312d0846e build: Updating development dependencies
* grunt-jsonlint: 1.0.4 → 1.0.7

Change-Id: I7748cc73763bc2d1396ab29262169809c0efd4db
2015-12-29 11:46:04 -08:00
Translation updater bot de2e4e6101 Localisation updates from https://translatewiki.net.
Change-Id: Ie5f3d5034564aea6f609f4f56b70deceb5d314bb
2015-12-22 22:11:20 +01:00
Thiemo Mättig 9b9d7d93c2 Author prefers full name in @author tag
Requested by the author in
https://gerrit.wikimedia.org/r/#/c/253327/1/includes/PageImages.php

Change-Id: I0e48ea1f3e7bc7098901562e7f048849c27e153a
2015-11-17 09:54:24 +01:00
Thiemo Mättig 369eda24b8 Add missing and fix wrong @license tags
Change-Id: I07f77735bb0050e2e59491d3c045b11705f3a08f
2015-11-16 15:59:34 +01:00
Translation updater bot 77dd2bb0f7 Localisation updates from https://translatewiki.net.
Change-Id: I2f89c63dbb83d38fa2e79b164d9c0d31077e79a9
2015-11-13 21:34:24 +01:00
Thiemo Mättig 9b65ac4def Organize code in includes/maintenance directories
Change-Id: I3a243074049a5b8b212de5bcd1e341c36e4a13e0
2015-11-12 08:33:43 +01:00
Translation updater bot 3f68a93660 Localisation updates from https://translatewiki.net.
Change-Id: I8cd6f4c5f2a7df3d5e82923baf0791963b73137a
2015-11-08 22:12:09 +01:00
Marius Hoch 4d81dbac99 Slightly improve type hints
Change-Id: I620135289b4f0ff95ed3013420194570c26b7a4f
2015-10-31 02:31:13 +01:00
jenkins-bot d55ef9d7e2 Merge "Use mExtensionData instead of undeclared class property" 2015-10-31 01:21:48 +00:00
jenkins-bot 41e8483a0b Merge "Add inline documentation and newlines for readability" 2015-10-31 01:21:46 +00:00
Translation updater bot abb498deeb Localisation updates from https://translatewiki.net.
Change-Id: Idd7c0d27efa9c935956183c24b5a20b849332698
2015-10-27 21:33:11 +01:00
Thiemo Mättig 1f1c72bb2c Use mExtensionData instead of undeclared class property
Change-Id: I155e37fda412cd467da7b34c52b34661c7c20224
2015-10-26 12:09:52 +01:00
Thiemo Mättig 23cf541f1b Add inline documentation and newlines for readability
Change-Id: I3a5a4ef67836cbfe0277f511f8b23030d248141c
2015-10-26 11:41:13 +01:00
Translation updater bot 00a663a893 Localisation updates from https://translatewiki.net.
Change-Id: I7aef32dd951c52468f64d9be0aa9e55d3b0343c1
2015-10-22 22:02:39 +02:00
Translation updater bot 7851ed8159 Localisation updates from https://translatewiki.net.
Change-Id: I2d02cb4e837400472a1d18252ab6b12e47b08447
2015-10-15 09:48:48 +02:00
Translation updater bot 4ac82d2836 Localisation updates from https://translatewiki.net.
Change-Id: I152f5aa28e847cccabf0062acf1e9723b7ac89a8
2015-10-13 22:12:24 +02:00
Translation updater bot e3488dd60b Localisation updates from https://translatewiki.net.
Change-Id: Ic594e7579032de698ff21b75a9e12f7eb9b073af
2015-10-12 21:05:25 +02:00
Kunal Mehta ca63a0c207 build: Updating development dependencies
* grunt-banana-checker: 0.2.2 → 0.4.0

Change-Id: I373da28af617774905140f8af53426a2935ae0d2
2015-10-11 11:54:23 -04:00
Translation updater bot 6c79e9833d Localisation updates from https://translatewiki.net.
Change-Id: I5b6a78f3d8bd320305a3c16f9aedc562063aef0e
2015-10-10 22:43:14 +02:00
Translation updater bot 4bf28a73d0 Localisation updates from https://translatewiki.net.
Change-Id: Ia30dc6ca5329d641dbd18c7fb56d187a3e253e8f
2015-10-09 22:32:51 +02:00
jenkins-bot 2d8fe5b5f7 Merge "Add example to ApiQueryPageImages via getExamplesMessages" 2015-10-09 13:47:52 +00:00
S Page cc9d7b143f Add example to ApiQueryPageImages via getExamplesMessages
Bug: T89035
Change-Id: Ia3410a35d7bfb1c234f2356b272c56a94cb11efb
2015-10-08 18:01:21 -07:00
Thiemo Mättig ccbee562f3 Add basic PHPUnit tests
This adds a few very basic tests to this component. I started doing this
while working on T112865 but later realized I do not need to touch this
extension. However, I started setting up tests and wanted to submit them.

Bug: T112865
Change-Id: I9d00b2baed8da97ffb6af94a6e3b8b63621b876a
2015-10-08 10:39:59 +02: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
Legoktm 1690d99e36 Revert "Include foreign files in ApiQueryPageImages"
Fatal error: Invalid operand type was used: cannot perform this operation with arrays

This reverts commit 47137e7ee6.

Bug: T114417
Change-Id: I89a2bfd69775a698f3000f48ea85465e193fb095
2015-10-01 21:23:23 +00:00
Sam Smith 47137e7ee6 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.

Bug: T98791
Change-Id: I6ef9a925c749ed6c830c0ff9bb824753df65740a
2015-10-01 10:43:12 +01:00
Translation updater bot d99db98331 Localisation updates from https://translatewiki.net.
Change-Id: I671cd831985dc34b77051d616984b496a3219961
2015-08-14 22:11:29 +02:00
Translation updater bot a5a4e0c1cd Localisation updates from https://translatewiki.net.
Change-Id: Idb6318e82262e7468594b97e32e6168bbdd974fc
2015-07-24 21:08:38 +02:00
jenkins-bot 5129d6aef4 Merge "Ensure $id is an integer" 2015-07-15 20:35:31 +00:00
Translation updater bot 0f86040dab Localisation updates from https://translatewiki.net.
Change-Id: Id0f8883452642257275a43fea40fffe1f80ca218
2015-07-05 22:01:24 +02:00
Kunal Mehta 1376545f36 build: Configure banana-checker and jsonlint
Change-Id: Idd179a1ba7ad183e3ab39d77c3428ef5046465d2
2015-06-19 22:01:11 -07:00
Translation updater bot 65b424b533 Localisation updates from https://translatewiki.net.
Change-Id: I99794917ef047c0d29a3a67c120076be7971eacc
2015-06-13 22:30:55 +02:00
Translation updater bot 7e38ce1bf3 Localisation updates from https://translatewiki.net.
Change-Id: I48f4f9b38631e9f23bc2ef809754ec1af73261c5
2015-06-09 22:48:42 +02:00
Translation updater bot ce854c22e5 Localisation updates from https://translatewiki.net.
Change-Id: Ia06da66fa67003be080f6234864ea8bc3971f415
2015-06-08 21:58:11 +02:00
Translation updater bot 8f7971cce4 Localisation updates from https://translatewiki.net.
Change-Id: Ifbecc5f593abf3a57e7a4476c23a95e4caed514a
2015-06-06 22:21:03 +02:00
Translation updater bot 4866faa243 Localisation updates from https://translatewiki.net.
Change-Id: Ibfd964b3dd4b65d076d4aac2ef28ddd15fb305a3
2015-05-27 22:28:26 +02:00
Translation updater bot 72c7599b35 Localisation updates from https://translatewiki.net.
Change-Id: I7fdb9becded00402f0fde8dbc940b7c772f85b4d
2015-05-21 22:58:58 +02:00
Translation updater bot d1901a9bea Localisation updates from https://translatewiki.net.
Change-Id: Iff08d54f7706e9b18803a3e670dc83c1bcf112d6
2015-05-20 22:16:06 +02:00