Commit graph

106 commits

Author SHA1 Message Date
Simon Legner d3f9a011fd Output multiple og:image with widths 1200/800/640
Multiple images are supported according to https://ogp.me/#array.
Facebook suggest an image with at least 1080px.
WhatsApp ignores images >300px.

Bug: T282065
Change-Id: Ibc18df03fbd6f4ec9f4970331e1b5bf930710816
2021-10-26 13:12:22 +02:00
Roman Stolar 6b4da12fd6 Replace deprecated Content::getParserOutput call to new one ContentRenderer::getParserOutput
Bug: T287158
Change-Id: Ia537b3a496e48237d427ad61a6db6268f63c769e
2021-10-21 18:19:03 +03:00
Alexander Vorwerk 73371eb33e Replace usage of deprecated PageProps::getInstance()
Bug: T289544
Change-Id: Ie30d3d2339ebf110a9827c3fa5cd604928abfd38
2021-09-26 14:40:10 +02:00
Kunal Mehta 7e13212a7c Check $thumb->isError() before trying to use it
$thumb might be an instance of MediaTransformError, which as the name
implies, is not really usable as a thumbnail and should be skipped
instead.

Bug: T290973
Change-Id: Ie818bd295bfe06c7c0dc0a2ea7dd273c7e0e416f
2021-09-14 09:56:05 -07:00
jenkins-bot f908355d17 Merge "Add a configuration to provide the fallback of og:image" 2021-07-28 16:03:39 +00:00
libraryupgrader 2f4755e065 build: Updating mediawiki/mediawiki-codesniffer to 37.0.0
Change-Id: I314da8a48195e98aed3605f18e9d0eab516ba026
2021-07-23 05:46:22 +00:00
lens0021 d526653e3a
Add a configuration to provide the fallback of og:image
Makes the fallback image be used when there is no image on a page.

Bug: T256935
Change-Id: I0bc4d55b20cc37edf46cb984a9a68617e2b4a89f
2021-06-18 12:16:36 +09:00
Petr Pchelko a0d2696e69 Remove leftover SearchResultPageIdentity typehints
Change-Id: I7a1dfc26d0985e645c785297c849e4c2854c034b
2021-05-14 19:21:16 -07:00
libraryupgrader 668d044574 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

npm:
* grunt: 1.3.0 → 1.4.0
* lodash: 4.17.19 → 4.17.21
  * https://npmjs.com/advisories/1673 (CVE-2021-23337)

Change-Id: I6797ecfc38973777657d1d4611363595b23e4afd
2021-05-12 19:05:01 +00:00
Clare Ming 4bb7aface9 Address voice and tone issues.
Replace instances of "blacklist" with "denylist" throughout extension.

Bug: T277955
Depends-On: Ib4985ec2fcb22eafad8f3a7cf9fc3161782a71db
Change-Id: Ibe460cb9691d56a9e83686b53c7629b5404af6fb
2021-05-07 20:39:38 +00:00
Thiemo Kreuz d8eceed585 Update PHPDocs and use PHP7 features where possible
Change-Id: I417ad041e268b88512de435c59695cb4338331cc
2021-05-04 16:51:18 +02:00
Umherirrender d1d7cfef0b Remove pre-1.35 code
Version was increased with I2f5251aa2f8298fd11096b27eea3e5ccf71f2103

Change-Id: I8df702f3ee7751a280b9821e0624ddcb1ce5b185
2021-03-06 18:26:23 +01:00
Umherirrender fa781357b5 Remove uneeded @return
Change-Id: I3813de58f8314938b7c3a193faa21b45b15f1dcf
2021-01-27 20:02:49 +01:00
Petr Pchelko 6fa0a18037 Stop writing objects into ParserOutput::setExtensionData.
As we switch ParserCache to JSON, we can no longer serialized
class instances in extension data. PageImages was writing the
full set of properies it received from Parser into it's extension
data, some of which are sometimes class instances. Instead, only
write the nessessary subset of data into extension-data.

This change is completely forward and backward compatible.
Since before this change we were already writing the same array,
but with many additional unused properties.

Bug: T266251
Change-Id: Ieb4a139465159611e6b3a99c4b68c3c174b1944f
2020-10-26 13:35:38 -07: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
lens0021 b4f1051c1d Thumbnail is too hard to type
Change-Id: I04b4f4fab359705df6f9d0d8439743fb2f26b3c5
2020-07-07 16:45:18 +09:00
DannyS712 a135c78cca Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: Icfccaa7795cd672c4f484377a33f7f62e37a7ffb
2020-05-19 23:27:50 +00:00
Aaron Schulz e26e89686e Convert $wgMemc use to WANObjectCache
Bug: T160813
Change-Id: I552079e093491ad3205c080909ded37c003830cf
2020-05-14 00:57:20 +01:00
Peter Ovchyn 6e004092ca rest: Verify that file exists before calling filesize
Bug: T252128
Change-Id: I2de87d723fdd99bea0f1dadd23648470759a103e
2020-05-07 19:33:49 +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 e688856810 Remove un-namespaced PageImages class
Change-Id: If761744fdc969e395a7cf7944ed6bf3738635384
2020-05-01 01:36:20 +00: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
Reedy 0cc54a66bd Move some classes to AutoloadNamespaces
Bug: T187154
Change-Id: I2f5251aa2f8298fd11096b27eea3e5ccf71f2103
2020-04-18 04:24:42 +01:00
Umherirrender 2775a9fa66 Use MediaWikiServices::getRepoGroup
This required MediaWiki 1.34

Change-Id: I90df4bcce40abbe8a1365cd1d65af0c23cf595bd
2020-04-12 00:23:49 +00:00
DannyS712 f22926df87 Use LinksUpdate::getRevisionRecord in MW 1.35+
Bug: T249397
Change-Id: I59759823a98f25dbfa633288a849aa9e01014683
2020-04-08 01:32:14 +00:00
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