Commit graph

18 commits

Author SHA1 Message Date
Pppery 3f2ce4da97 Partially fix class-file name mismatch sniffs
Fix one instance of bad code that triggers both MediaWiki.Files.ClassMatchesFilename.NotMatch
and MediaWiki.Files.OneClassPerFile.MultipleFound. One more set of errors remains.

Bug: T170583
Change-Id: I45c237b4366477954726a0116fb2d56256276693
2017-12-06 23:35:36 -05:00
Thiemo Mättig 4674c77e45 Family name of Thiemo changed
Change-Id: I74bf3041439e839b575ff5c163427b5c032c4398
2017-11-24 08:33:49 +01:00
Kunal Mehta 924efcc96e build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I3554682b5c8686299dc8cf23a3ec8c59514ff008
2017-06-25 17:26:03 +00:00
Umherirrender 88758f5884 Add phpcs and make pass
Change-Id: I129fd23a375b4f7de893d3b98f67fdd8de89b4bd
2017-05-30 21:49:44 +02:00
jenkins-bot 9b63fdc577 Merge "Make PageImages default API license parameter configurable" 2017-05-20 16:02:19 +00:00
aude 97572615e0 Make PageImages default API license parameter configurable
Bug: T156190
Change-Id: Id4b43f2597d5a063dca0d46f308b6283620e9974
2017-05-20 17:36:56 +02:00
Baha a7fc68ced6 Increase default API limit from 1 to 50
Bug: T153709
Change-Id: Ie7c48117ac94e4902948f7336b5e1da7229dbe2d
2017-05-19 09:06:04 -04:00
Gergő Tisza 928a8f6687 Switch TestingAccessWrapper to librarized version
Bug: T163434
Change-Id: Ie3d29b3522d5e176430708b15359803d76a39a2f
Depends-On: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 11:35:03 +00:00
Baha 83e712791f API: return free images by default
The maintenance script to populate free images has finished executing.

Follow-up on I1d35e965dc37c8c4ecdcc43313b3198e951e1978.

Bug: T152216
Change-Id: I32669e937efa6f5566eee582b911d170a32762e3
2017-01-19 15:20:00 -05:00
Michael Holloway a8c7cbc870 API: Surface dimensions when requesting original image info
It's useful for API consumers to have the dimensions of the original
image so that they know the bounds within which they can safely rewrite
the thumb URL (bearing in mind the prerendered widths[1], in the case of
WMF wiki consumers).

This change adds an 'original' property to the page object, containing
the original image source URL along with its width and height, when
original image info is requested.

A warning is added when original image info is requested, noting the
format change and warning the consumer that the original image URL will
no longer be provided within the 'thumbnail' property in a future release.

[1] https://github.com/wikimedia/operations-mediawiki-config/blob/master/wmf-config/InitialiseSettings.php#L17535

Bug: T152163
Change-Id: I9d937f73a974dfb099b93552405531464b8ad3ae
2017-01-17 15:07:28 -05:00
Max Semenik 5145dd3d74 Convert to new array syntax
Change-Id: Iaec0c9ad47d28559adb8c46a82a00a61fba3602d
2016-12-01 16:49:13 -08:00
Erik Bernhardson f6f6bf00e1 Page images return non-free images by default
Page images was updated to have a split between the 'best' page
image, and the best free page image. Unfortunately the deployment
plan didn't take into account that the default 'free' would be
pointing to an unpopulated page prop, which will not be populated
until LinksUpdate has run for every page on every wiki which could
take weeks or months.

To restore some semblance of order, make the default point at the
currently populated field. A followup will need to be done to
populate the appropriate field.

Bug: T152155
Change-Id: I1d35e965dc37c8c4ecdcc43313b3198e951e1978
2016-12-01 23:54:14 +00:00
Baha 382c70f981 Allow querying non-free images too
The API accepts a new query parameter `license`, whose
value can either be `free` or `any`. `free` is the default value.

When the value of `licence` is:
  * `free`, then only the best image whose copyright allows
    reusing it will be returned;
  * `any`, then the best image, regardless of its copyright
    status, will be returned.

Bug: T131105
Change-Id: I83ac5266e382d2d121aff3f7d28711787251c03b
2016-11-21 17:29:25 -05:00
Baha 7617affabd Add phpunit tests
The tests cover ApiQueryPageImages::execute.

Change-Id: I22619c860aa3d1ed859a00f0e6f29dbb6f61b85b
2016-11-18 06:02:52 -05:00
Thiemo Mättig 369eda24b8 Add missing and fix wrong @license tags
Change-Id: I07f77735bb0050e2e59491d3c045b11705f3a08f
2015-11-16 15:59:34 +01:00
Thiemo Mättig 23cf541f1b Add inline documentation and newlines for readability
Change-Id: I3a5a4ef67836cbfe0277f511f8b23030d248141c
2015-10-26 11:41:13 +01: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