Commit graph

70 commits

Author SHA1 Message Date
Umherirrender 272b98a34c Pass string as field to IDatabase::selectField
It is documented as string, because it can only select one field,
not a list of fields

Change-Id: Id3e51bdc12a2abea16e4963ea95caf7f9213f853
2019-02-28 21:21:11 +01:00
Thiemo Kreuz 71b5c4db22 Relax score calculation in LinksUpdateHookHandler to use floats
This allows to use floats in the $wgPageImagesScores configuration.
Before, decimal places have just been cut off with no warning. I find
this pretty unexpected. When I see the terminology "score" being used,
I always think of float values. I checked all the code that consumes
these scores (it is all internal to LinksUpdateHookHandler), and it's
all fine with floats. I don't see a reason to forcefully cut decimal
places off.

Bug: T212013
Change-Id: I0f1f0ea0865f07b3e58a2fc142dcd838eb687c97
2019-01-10 09:31:20 +01:00
Thiemo Kreuz 0fd9a2b5f4 Fix score calculation in LinksUpdateHookHandler failing on unordered input
This patch is motivated by Iad694e0.

* I rearranged the code a little bit to avoid a duplicate line of code.
* I added a ksort() and a comment explaining it.
* Additional tests demonstrate why the ksort() is needed.
* I had to refactor the tests a little bit to allow for more test cases
  that have been missing before.

Bug: T212013
Change-Id: Ia96dc8c6cf57ddcea410a7300756d0013052ac79
2019-01-10 09:26:54 +01:00
Thiemo Kreuz ba066df1e2 Don't use non-images as candidates, e.g. audio files from a <gallery>
Bug: T212013
Change-Id: Ibed6effb7b46d420264730f4ec2b11c34c0159f4
2019-01-09 13:12:38 +01:00
Peter Boehm cd2115f80d Reenable Indexing for Images
PageImages returned no images, found the solution here:
https://www.mediawiki.org/w/index.php?title=Topic:Txp3e225prn7u8mf&topic_showPostId=uf6ic04q8nneq
- thanks to the anonymous helper

Bug: T203965
Change-Id: I6a024d27edf9060f7bf3ffb0d51761b0a86f6696
2018-09-26 23:36:40 +00: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 494c9b53c0 Stop setting PAGE_IMAGES_INSTALLED
Callers should check with ExtensionRegistry instead.

Bug: T200381
Depends-On: I0b9725fa4b3c4ce4fbb1004cfd3570ba39865fc1
Depends-On: Ib9a480396fc28358e681f749f80800c9bab4e0d0
Change-Id: Ibe4384238161edc8d40cff5e2a532fb36ecec64d
2018-07-25 18:20:55 -07:00
Kunal Mehta a9ad31c7f8 Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag issues
Change-Id: I3b0c14dcd5961254d49a98df4061f8ff83589f3a
2018-05-24 21:42:59 -07:00
Umherirrender ebbfdf7a1b Remove backward compatibility code for 1.25
Extension requires 1.29 in extension.json
ApiResult::META_CONTENT exists since 1.25

Change-Id: Ibdbabf628975b277b2d3cc01e5b8ff12116fb97d
2018-04-25 22:01:49 +02: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
Umherirrender bc4b81c7bb Adjust InitImageDataJob
$params cannot a bool here
Job::run has to return a bool

Change-Id: Ieed6675e8de0e3ed4c3376676d5b027a6ab9f4f2
2018-04-10 19:11:55 +00:00
Umherirrender 2db7a8728e Migrate call to Http::get to use options for timeout
Since 1.25 the timeout is part of the options array.
Also added the caller for profiling

Change-Id: I111b1a0199f8a5fd0bfcfb490717861757f1d496
2018-04-05 10:14:50 +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 d81dfe6e9e Re-enable "MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" sniff
Bug: T170583
Change-Id: I76ed85cf960269c5692e9ec8c92877bcb13e4100
2017-12-07 14:02:09 +00: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
Thiemo Mättig 4674c77e45 Family name of Thiemo changed
Change-Id: I74bf3041439e839b575ff5c163427b5c032c4398
2017-11-24 08:33:49 +01: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
libraryupgrader c3fe4c1fa7 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: Ide53c76f5c1cf7ae0313d06eeaccccbc90de259e
2017-09-24 05:30:58 +00:00
libraryupgrader aa8dabebb2 build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
The following sniffs are failing and were disabled:
* MediaWiki.Files.ClassMatchesFilename.NotMatch
* MediaWiki.Files.ClassMatchesFilename.WrongCase
* MediaWiki.Files.OneClassPerFile.MultipleFound

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch

Change-Id: Ibb3e8fbef168f886d2385565df85015c08b2f02a
2017-09-01 04:54:58 +00: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
jenkins-bot 457c1568aa Merge "Add phpcs and make pass" 2017-06-02 21:28:32 +00:00
Umherirrender 88758f5884 Add phpcs and make pass
Change-Id: I129fd23a375b4f7de893d3b98f67fdd8de89b4bd
2017-05-30 21:49:44 +02:00
Brad Jorsch b7b6185dae Chunk page ids in internal API call to avoid too-many-pageids-for-query
One of many reasons that internal API calls are bad.

Bug: T41936
Change-Id: I338b444087c7570e455469e2c0fad8f5ca46644e
2017-05-26 17:24:39 -04: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
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
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
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 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