Commit graph

81 commits

Author SHA1 Message Date
DannyS712 eb381bbb8f PHP coding conventions: reorder doxygen tags
See https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Doxygen_tags

Change-Id: I0f0a397c4b4e2e266ea050e92b67c01cee73f3bf
2020-03-26 15:50:02 +00:00
Petr Pchelko 381512b11f Remove usage of deprecated Revision::newFromTitle
Bug: T246284
Change-Id: I4e0a197bbc51b4d05e6519fb2447c0f791d40380
2020-03-03 20:26:09 -08:00
libraryupgrader 0778590638 build: Updating composer dependencies
* jakub-onderka/php-console-highlighter: 0.3.2 → 0.4.0
* mediawiki/minus-x: 0.3.2 → 1.0.0
* mediawiki/mediawiki-phan-config: 0.9.0 → 0.9.1

Change-Id: I79f9a3251904e6e7a0e1c27d64d242b40bbc1012
2020-02-04 19:17:43 +00:00
libraryupgrader 712d006ba3 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: I5e714b548aa11857b5631df94c075fa0e4e7ce81
2020-01-14 08:48:00 +00:00
Umherirrender 570e1a8599 build: Updating mediawiki/mediawiki-phan-config to 0.8.0
Bug: T235049
Depends-On: I42d38a8e653d27a4d430ab78bba8b4f3988d7a27
Change-Id: I43ec99bf88b3eebc2d9c31007a559de3cb9e0d2d
2019-11-04 19:18:18 +01:00
jenkins-bot 9060029d88 Merge "Optimize ApiQueryPageImages::getTitles" 2019-11-01 02:17:37 +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
Umherirrender 5c0a57c9f8 Do not query pageimages for special pages and not-existing titles
Save on query on each page view of special page

Change-Id: Id6e79ba891ed917b40fa33f63e0d8f318d1ca269
2019-10-31 20:43:23 +01:00
Simon Legner e1b6ba7da4 PageImages on File namespace should be the file itself
The file page for an image should include the `og:image` meta tag. Thus,
a thumbnail is shown for the image when posting a link via social media.

Relates to Ide250d489a1ceedd7e896a3b44471752f0971fb1.

Change-Id: I81435289a4a6c7749462ba447aa626120a9c821c
2019-08-15 15:11:51 +02:00
Tim Starling 4d11163e5e Use READ_LATEST during LinksUpdate
The hook is called during page move. If you try to fetch the current
page content from the replica, it won't be there with the specified
title, causing an exception.

Bug: T221763
Change-Id: Ib91bf399f251fc715d8f27a4f8f7f4c9db9d30c8
2019-07-25 14:11:05 +10: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 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