Commit graph

750 commits

Author SHA1 Message Date
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
Translation updater bot e53154dae0 Localisation updates from https://translatewiki.net.
Change-Id: I59d71e7df7ff4a37219a53b66fab3b4661b36a6f
2017-01-18 22:18:56 +01: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
Translation updater bot 25567fa7df Localisation updates from https://translatewiki.net.
Change-Id: I2847b1b4b66e9a97356d2e84df3a62c7d90ac59d
2016-12-22 22:56:36 +01:00
jenkins-bot ee9a09ca27 Merge "Provide test case for getPageImageCandidates" 2016-12-21 16:41:02 +00:00
Translation updater bot 208e36a11f Localisation updates from https://translatewiki.net.
Change-Id: Ia8243102d57f23b6d7105e464410c36afe7f589c
2016-12-14 22:25:46 +01:00
jenkins-bot 658d7feb66 Merge "Fix typo: page_ids -> pageIds" 2016-12-12 21:31:29 +00:00
Erik Bernhardson 8d040dfb1f Fix typo: page_ids -> pageIds
Change-Id: I7054d36bea58c06cd97c704f44c1fec8a23245bc
2016-12-09 17:08:33 -08:00
jenkins-bot aea9c2fab7 Merge "Don't count abandoned jobs as job queue pressure" 2016-12-09 18:17:36 +00:00
jdlrobson 5e1d488d65 Provide test case for getPageImageCandidates
Additional changes:
* Add test @covers statements for existing tests for code
coverage purposes

Change-Id: I1a0d2d331c79df3e5505ae54d27f23e1cb5b910c
2016-12-08 20:12:03 +00:00
Erik Bernhardson 6f0f3e7dc6 Don't count abandoned jobs as job queue pressure
It looks like the reason these jobs arn't processing is because
abandoned jobs are being considered as part of the acquired jobs
count, so if a job gets abandoned it keeps taking up a slot in
our job pressure calculation. These shouldn't count as pressure
because they are not running anymore.

Change-Id: I44fbce2b7dc47345ab0e3745d1653f418d75943d
2016-12-08 11:46:46 -08:00
jenkins-bot 4e9444f3f3 Merge "Restrict page images to lead section" 2016-12-08 19:26:39 +00:00
jdlrobson 00b9f9fdc4 Restrict page images to lead section
When $wgPageImagesLeadSectionOnly is true restrict
the scoring of page images to images in the lead section.
This results in an additional parse of the lead section of the
content, but this should only happen once after an edit
has occurred and is deferred.

If false all images will be considered as candidates for
the page image choice.

Note that the choice between modes is per site not by
request. This is intentional to avoid having to store 4
different properties respecting license and
article position. As a result when enabling or disabling
this switch on existing setups, there will be a transitional
period where pages previously parsed will show pageimages
as calculated by the previous value of this config variable.

Bug: T87336
Change-Id: I09bdae82515f6e93f5606553259f10b3a10e9eaa
2016-12-08 10:41:21 -08:00
Erik Bernhardson 9b20854a59 Wrap waitForReplication in try/catch
Very few of these jobs seem to be finishing, due to some
replicas being so far behind we get DBReplicationWaitError
thrown, which causes the job to be restarted. Catch and log,
but don't stop processing because of it.

There is also a problem with jobs that blow out the memory limits,
but not sure what to do with that.

Change-Id: Idffcfad76936f5e62e9018c58f2cb57db35af4b8
2016-12-07 10:18:53 -08:00
Erik Bernhardson 03e14d0c86 Add job queue option for initImageData maintenance script
Trying to run this script in the cluster fatals out due to memory
problems somewhat regularly. The --start option helps to restart
it where it fell down, but when trying to run against hundreds of
wiki's that is a one-off solution that makes ensuring everything is
actually visited a pain.

To try and isolate errors add an option to push the parsing into the
job queue. There is still the possibility to miss pages, but job queue
retries should take care of us for the most part. Attempts to keep
load down on the databases by making sure no more than a specified
number of jobs are queued/processing at a given time.

Bug: T152155
Change-Id: I3a4e3a415b2f03de0bb36ac0515241e950130fde
2016-12-06 10:56:52 -08:00
Baha 9215a7f9d9 Choose the best image
Follow up to If6cbb82f01fa298945c615a2f25e972a9d767d58
Change-Id: I5e46985bfd22b2f96eb659a3d14137bdadbc4b99
2016-12-03 02:44:11 +00:00
jenkins-bot 7fa933cf00 Merge "Return any image, not just the non-free image" 2016-12-03 01:32:39 +00:00
Baha 250103022d Return any image, not just the non-free image
The mobileview API directly accesses the page image,
bypassing the PageImages API.

I1d35e965dc37c8c4ecdcc43313b3198e951e1978 fixes the issue for
the PageImages API.

This patch fixes the issue for the mobileview API.

Change-Id: If6cbb82f01fa298945c615a2f25e972a9d767d58
2016-12-02 20:29:35 -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
jenkins-bot e0d6962b5b Merge "Cleanup InitImageData" 2016-12-02 00:41:40 +00:00
Aaron Schulz e69dcb670a Cleanup InitImageData
* Use standard --batch-size parameter
* Added --start parameter
* Use MediaWikiServices

Change-Id: I5828db7b9fb7ba12eeb3ce3313c4fe7e7926c916
2016-12-01 16:21:36 -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
Translation updater bot a466721058 Localisation updates from https://translatewiki.net.
Change-Id: I396f709196bdfc4ed19658e5595207307cbdca50
2016-11-28 22:30:55 +01:00
Translation updater bot 96624ac2e9 Localisation updates from https://translatewiki.net.
Change-Id: I4e9a0442c4106c6902fcfff676d49c944e3f3452
2016-11-27 22:31:20 +01:00
Translation updater bot 87571d46f1 Localisation updates from https://translatewiki.net.
Change-Id: I845d2bca9f8cd63265025f123ae295aabee0756b
2016-11-25 22:52:51 +01:00
Translation updater bot 9a038c19a3 Localisation updates from https://translatewiki.net.
Change-Id: I40a2f46cd64520d3729f85937148efad055c194a
2016-11-24 22:21:34 +01:00
Translation updater bot 22dc62a3ca Localisation updates from https://translatewiki.net.
Change-Id: I384eeb7a7be5416e97027caa9292e8c339afc934
2016-11-23 22:39:16 +01:00
Translation updater bot f146b84dae Localisation updates from https://translatewiki.net.
Change-Id: Ia8799a3d72c43c6cee367fe1f0bfbd16d58ea80d
2016-11-22 23:26:25 +01: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
Baha 7617affabd Add phpunit tests
The tests cover ApiQueryPageImages::execute.

Change-Id: I22619c860aa3d1ed859a00f0e6f29dbb6f61b85b
2016-11-18 06:02:52 -05:00
jenkins-bot bd273db64b Merge "Add phpunit tests" 2016-11-16 22:51:45 +00:00
Baha 76108cba37 Add phpunit tests
Bug: T131105
Change-Id: Ib774f18e62f050f48783e5ccccaedc23000533d2
2016-11-16 16:34:19 -05:00
Translation updater bot 009be59a30 Localisation updates from https://translatewiki.net.
Change-Id: Id5b4cfda9bd479e2ec51b36e4b6554e971bb5881
2016-11-15 22:58:14 +01: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
Chad Horohoe 912335ce39 Whoops, track not trace
Change-Id: I2dcc6c7e9dce5d924d74d3653fdfc7a18a02d053
2016-10-24 17:03:10 -07:00
Chad Horohoe 6665071188 Swapping defaultbranch for trace
The former is a maintenance nightmare when branching.

Bug:T146293
Change-Id: Ic34d551709c6f436994b5a9957047ff5de65b771
2016-10-24 16:38:04 -07:00
jenkins-bot 88481cab07 Merge "Convert PageImages to extension registration" 2016-10-17 16:10:59 +00:00
Reedy d52f94205f Convert PageImages to extension registration
Bug: T87953
Change-Id: Icc9096060899b9e401d53590f38865b0937a73ff
2016-10-16 20:45:54 +01:00
Translation updater bot eef1d08d98 Localisation updates from https://translatewiki.net.
Change-Id: I7f26a75c6881f15cce5bb9b6eda9be6591fb6b75
2016-09-20 22:40:14 +02:00
Translation updater bot 48bbbd1497 Localisation updates from https://translatewiki.net.
Change-Id: Ic798f2003eda92206eed5fb85b9d85bd08c15391
2016-08-08 22:34:40 +02:00
Translation updater bot 59fcfc3bee Localisation updates from https://translatewiki.net.
Change-Id: Id7e66681bcd69f36e97999dae931d938c57e1122
2016-08-05 22:33:48 +02:00
Translation updater bot 8faba0d003 Localisation updates from https://translatewiki.net.
Change-Id: I49971695d25b0b95c5f3364f38588d520f78e8aa
2016-04-12 22:55:40 +02:00
Kunal Mehta 27a48ae1bf Use DatabaseBase::addQuotes() for quoting query conditions
Change-Id: Ia63d5af2c01b9441e601c8ba11e8e9f1b5da95a9
2016-04-04 16:34:23 -07:00
Thiemo Mättig 6c53cac48e Refactor duplicate code in LinksUpdateHookHandlerTest
Change-Id: I9acaadf18e859758cd7bdcb7d260007402695060
2016-03-10 16:27:40 +01:00
Gergő Tisza 151a5d7248 Add sanity check test for LinksUpdateHookHandler::getMetadata
Change-Id: I840902c8397c8442def8239504ce1cfa8eafbb8e
2016-03-07 22:53:00 +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