There has been cases of different extensions calling this function
for the same page title within the same web request, leading to
duplicate queries and roundtrips. This avoids those.
Maybe in future we could have APCu cache for it.
Bug: T322528
Change-Id: I9b08b4de2648bf794bfdbfe57de9db433cfd79ee
Remove using of User:getOption since this method will be hard-deprecated. Now it is soft-deprecated
Bug: T296083
Change-Id: Ia6c2fb8a4510cc55e424fc23816e71b2b93732b4
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
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
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
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
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
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
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
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
* 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
User::getOption() already handles that, and this code bypassed the hook
in User::getDefaultOptions().
Change-Id: I41f9df177988dffd62de0060cb691a97161729e4
This patch only moves existing code around, but does not change any
implementation detail.
I found it very suprising that all code called by these two hook handlers
is 100% exclusive to these hook handlers. There is zero interaction
between these hook handlers code and all other code. Why is it in the
same file then? And why is it all static? It doesn't have to be. I
had to change literally nothing, except cutting and pasting, removing
all "static" and replacing all "self::..." with "$this->...". That's
all.
Change-Id: I7fdc582db425d3b95f7d02934b439eb9c102e712
This patch only moves existing code around, but does not change any
implementation detail.
I found it very suprising that all code called by this hook handler
is 100% exclusive to this hook handler. There is zero interaction
between this hook handlers code and all other code. Why is it in the
same file then? And why is it all static? It doesn't have to be. I
had to change literally nothing, except cutting and pasting, removing
all "static" and replacing all "self::..." with "$this->...". That's
all.
Change-Id: I5ffe6fdf4e57135e6f3b32636c80f22be758607c