Commit graph

314 commits

Author SHA1 Message Date
Translation updater bot 8334aab55b Localisation updates from https://translatewiki.net.
Change-Id: Ib43b01cffd470c8af735e0b3b7d8ccea0a291c32
2017-02-15 22:35:48 +01:00
Translation updater bot 7ca697ddbe Localisation updates from https://translatewiki.net.
Change-Id: I24abd8978329315809c509872c211c0847ad6a6a
2017-02-14 22:44:03 +01:00
Thiemo Mättig (WMDE) 6deb3fc986 Revert "Add twitter meta tag for image"
This tag is useless and does nothing without og:title and
og:description also being present, which is not the case
right now. A more complete patch should re-introduce all
three tags in one go.

It is also questionable if this tag belongs to this
extension, because it is explicitly said that the image is
an optional element of a Twitter card. og:title and
og:description are not optional. og:description would
probably be set by the TextExtract extension. This means
this Twitter card tag belongs more to TextExtracts and not
to PageImages.

This reverts commit 2e83a2c1dc.

Bug: T157145
Change-Id: I17ffe8f83d91156a79facb4c35b4a15ecc49f108
2017-02-08 14:27:29 +00:00
Amir Sarabadani 2e83a2c1dc Add twitter meta tag for image
Bug: T157145
Change-Id: I8605b69b658b99941d63db3707ae6c2c0cf1b2ce
2017-02-04 04:14:16 +03:30
Amir Sarabadani b6296a4593 Reduce the thumbnail size to 1200px
Bug: T142048
Change-Id: I28f3c3274f77560ca856695e19e32fb1df3f8e66
2017-02-01 19:07:25 +03:30
jenkins-bot bee7615bb8 Merge "Add basic test for PageImages::onBeforePageDisplay" 2017-01-31 21:05:24 +00:00
Thiemo Mättig a7a74f51ce Add basic test for PageImages::onBeforePageDisplay
This is still only testing negative cases with no page image.

In addition this patch does sort all the hook handlers
alphabetically, and adds a missing PHPDoc block.

Bug: T51859
Change-Id: Iea65f2181dd3cac3ec2ceac191f002f74af3ec24
2017-01-31 19:43:12 +00:00
Amir Sarabadani 571e0d120e Reduce the thumbnail width to 1280px
See https://phabricator.wikimedia.org/T142048#2987319

Bug: T142048
Change-Id: I2b7d3dc1eaac74c2e48d327b8bb9956e1648edbe
2017-01-31 22:45:06 +03:30
Amir Sarabadani e5cbfdb221 Add PageImage OpenGraph tag
Bug: T101711
Bug: T142048
Bug: T51859
Change-Id: Idd9125ad06964f50cbad70283819107611cfec44
2017-01-30 22:24:02 +03:30
jenkins-bot ee36518329 Merge "Document page property names" 2017-01-24 21:53:50 +00:00
jenkins-bot d07a770a54 Merge "API: return free images by default" 2017-01-24 20:11:53 +00:00
jdlrobson 21963c89ea Document page property names
This should protect us when we consider renaming these variables
in future.

Bug: T152239
Change-Id: I227ffd0867f797d6a450b8b51759338cff7ee3a8
2017-01-23 23:12:11 +00:00
jdlrobson e44969eca0 UseGalleries is unused
Unless I'm mistaken this config variable has never been used
in this codebase since introduction in
I64e997d58e4a1b66a8a351d85a3e7df1a77354e9

It's not documented so not clear why it is needed
and not referenced in this codebase.

Change-Id: Ib227eefb77ba2719db277fa80a8bfb958ea6a778
2017-01-23 12:20:58 -08:00
Translation updater bot 1a5bd00330 Localisation updates from https://translatewiki.net.
Change-Id: I4022e79402392aa06593a05092e26f8b599414a5
2017-01-20 09:35:27 +01: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
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