Commit graph

37 commits

Author SHA1 Message Date
Umherirrender fa781357b5 Remove uneeded @return
Change-Id: I3813de58f8314938b7c3a193faa21b45b15f1dcf
2021-01-27 20:02:49 +01:00
jgiannelos d9fd6c8679 Add language param in prop=pageimages API
* Images on pages can be localized (eg. SVG text)
* Allow API consumers to select the language the images are rendered in

Bug: T257082
Change-Id: I05f498444c55aea9028a58de80e21ba1e236bf02
2020-08-19 11:59:05 +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
Reedy b14685b8d5 Namespace the other two classes in PageImages
Leave alias for PageImages as it's used elsewhere...

Change-Id: I4a3fa5f8aaafd87c78b03f04369a73f4b4f1b189
2020-04-19 23:06:20 +00:00
Umherirrender 2775a9fa66 Use MediaWikiServices::getRepoGroup
This required MediaWiki 1.34

Change-Id: I90df4bcce40abbe8a1365cd1d65af0c23cf595bd
2020-04-12 00:23:49 +00:00
Umherirrender 0de5777cf7 Optimize ApiQueryPageImages::getTitles
Avoid array_map/array_flip + foreach when doing the simple thing also in
the foreach

Swap Title::newFromText to Title::makeTitle to avoid reparsing the
string

Bug: T237068
Change-Id: I745cb9bd817a4b2274c6f778c38c58846ef318c1
2019-10-31 23:08:13 +00:00
libraryupgrader 75000f5154 build: Updating mediawiki/mediawiki-phan-config to 0.5.0
Change-Id: I7d94649c26fda91cf8072c9530ca8e59f42f8b9a
2019-03-10 22:28:35 -07:00
Umherirrender da5312fb70 Remove backward usage of ApiBase::dieUsage
ApiBase::dieUsage is deprecated since 1.29, this extension required
1.29

Change-Id: Ide05c1dc6a92708deaf859e6963b607194133b5d
2018-08-18 15:53:42 +00:00
Kunal Mehta a9ad31c7f8 Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag issues
Change-Id: I3b0c14dcd5961254d49a98df4061f8ff83589f3a
2018-05-24 21:42:59 -07:00
Umherirrender fd0d231a3c Remove backward compatibility code for 1.25
Extension requires 1.29 in extension.json

Change-Id: Ie58a10402c207fa097eedd760b22a891d0a8cc78
2018-04-25 21:46:58 +02:00
Pppery 60735a010d Remove old string-based API description functions
These have been deprecated since MediaWiki core 1.25 and no longer have any effect.

Change-Id: Icbaaa395af8303c1018e92ab2bfddb02ed587115
2017-12-17 23:58:15 +00:00
Pppery 8d98456184 Clarify documentation of pithumbsize parameter
Bug: T178910
Change-Id: I5a17dbff135c553c98767b642d24219b7a5c8c2d
2017-12-07 19:54:33 -05:00
Pppery ade8e44b21 Re-enable "MediaWiki.Commenting.FunctionComment.MissingParamComment" sniff
Bug: T170583
Change-Id: I3a5a849c168aed7ab6ea479bab5ec7d9b809dd6f
2017-12-07 14:56:10 -05:00
Pppery 3b500b9926 Re-enable "MediaWiki.Commenting.FunctionComment.MissingReturn" sniff
Bug: T170583
Change-Id: Iad521de387dce704db5552168b18f2653cd3e291
2017-12-07 13:33:35 +00:00
jenkins-bot b363e0d92e Merge "Re-enable "MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" sniff" 2017-12-06 22:53:52 +00:00
Pppery fe1aad4adf Re-enable "MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" sniff
Bug: T170583
Change-Id: I33b56a824d26feb208492e8623c3c654a1372c47
2017-12-06 17:48:13 -05:00
Pppery 0b71ffcf13 Re-enable "MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" sniff
Bug: T170583
Change-Id: Ib55d299da9c52da02246037fd8be899372758f11
2017-12-06 16:59:16 -05:00
Michael Holloway a9af75cbc4 Hygiene: Remove legacy 'original' property from 'thumbnail' output
Original image info is now a first-class output property, and the
'original' property of the 'thumbnail' object has been deprecated since
December 2016 (with an API warning provided since then when original image
info is requested).  It should be safe to remove at this point.

(N.B. The 'original' property was an undocumented piprop before the format
update, and the legacy output likely sees little if any usage.)

Bug: T152163
Change-Id: I73b476f9e50c14f705a30e20bc836b8db371f5f0
2017-10-30 17:48:04 -04: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
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
jenkins-bot 2cf50b6340 Merge "Convert to new array syntax" 2016-12-02 23:11:38 +00:00
rlot c45564e22f Implement "Help" link for the PageImages Api
Implemented getHelpUrls() function in ApiQueryPageImages.php

Bug: T97835
Change-Id: Ia6416bd67d92809422a54431764602da555236e9
2016-12-02 20:04:09 +01: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
Brad Jorsch 26a2dab573 Update for API error i18n
See Iae0e2ce3.

Change-Id: Ib87f051a50f3073d5d4e60094036a307bfe198cb
2016-11-29 12:43:18 -05:00
Baha c34a838f73 Fix phpcs warnings and errors
Change-Id: I5c3c685f286fb379c7a1be3d483665cbb43ca803
2016-11-21 18:29:28 -05: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
Mukunda Modell c399c4156e Don't attempt to call methods on $file if it's not an object
This fixes a fatal which is blocking deployment of 1.29.0-wmf.1
refs T149059 fixes T149849

Bug: 149849
Change-Id: Ieb61585af3aa60b7af58597091151d0b494b2fd6
2016-11-03 18:36:32 +00: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
Petr Matas 5a60c10b1a Thumbnails generated from SVG may be larger than original
Bug: T128278
Change-Id: I2b10ff28389fd9c99f0703d7ae4ee2d63e0bd000
2016-03-02 12:21:00 +00: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
Thiemo Mättig 9b65ac4def Organize code in includes/maintenance directories
Change-Id: I3a243074049a5b8b212de5bcd1e341c36e4a13e0
2015-11-12 08:33:43 +01:00
Renamed from ApiQueryPageImages.php (Browse further)