Commit graph

27 commits

Author SHA1 Message Date
Thiemo Mättig 4674c77e45 Family name of Thiemo changed
Change-Id: I74bf3041439e839b575ff5c163427b5c032c4398
2017-11-24 08:33:49 +01: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
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
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
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 9215a7f9d9 Choose the best image
Follow up to If6cbb82f01fa298945c615a2f25e972a9d767d58
Change-Id: I5e46985bfd22b2f96eb659a3d14137bdadbc4b99
2016-12-03 02:44:11 +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
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
Reedy d52f94205f Convert PageImages to extension registration
Bug: T87953
Change-Id: Icc9096060899b9e401d53590f38865b0937a73ff
2016-10-16 20:45:54 +01:00
Thiemo Mättig 4fee70fc1f Remove not needed "return true" from hook handlers
* 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
2016-03-07 12:07:06 +01:00
jenkins-bot 9f09934913 Merge "Extract ParserMakeImageParams/AfterParserFetchFileAndTitle hook handlers" 2016-02-12 17:29:37 +00:00
Kunal Mehta 59afdff5d5 Don't pass default pref as fallback to User::getOption()
User::getOption() already handles that, and this code bypassed the hook
in User::getDefaultOptions().

Change-Id: I41f9df177988dffd62de0060cb691a97161729e4
2016-01-26 10:07:39 -08:00
Thiemo Mättig fe0da50344 Extract ParserMakeImageParams/AfterParserFetchFileAndTitle hook handlers
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
2016-01-18 13:00:21 +01:00
Thiemo Mättig d9df7178a0 Extract LinksUpdateHookHandler to separate file
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
2015-12-30 13:40:48 +01:00
Thiemo Mättig 9b9d7d93c2 Author prefers full name in @author tag
Requested by the author in
https://gerrit.wikimedia.org/r/#/c/253327/1/includes/PageImages.php

Change-Id: I0e48ea1f3e7bc7098901562e7f048849c27e153a
2015-11-17 09:54:24 +01:00
Thiemo Mättig 369eda24b8 Add missing and fix wrong @license tags
Change-Id: I07f77735bb0050e2e59491d3c045b11705f3a08f
2015-11-16 15:59:34 +01:00
Thiemo Mättig 9b65ac4def Organize code in includes/maintenance directories
Change-Id: I3a243074049a5b8b212de5bcd1e341c36e4a13e0
2015-11-12 08:33:43 +01:00
Renamed from PageImages.body.php (Browse further)