Commit graph

64 commits

Author SHA1 Message Date
Umherirrender bbbcca4b38 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I6b49b9837ed6d3dfdd8a4bc0420848c09fcb1540
2024-10-20 11:10:45 +02:00
Umherirrender 3703c048cc Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I780e57da1ea02eb333cf61abd999dc737acf20d1
2024-06-09 19:03:17 +02:00
Umherirrender d0c0dc9caf Migrate to IReadableDatabase::newSelectQueryBuilder
Also use expression builder to avoid raw sql

Bug: T312501
Bug: T350988
Change-Id: I0ea6aa6edcd68cba067260dad560b87283cca020
2024-04-22 18:58:42 +00:00
Fomafix 6c80d95abe Use MainConfig instead of global variables
Use overrideConfigValue instead of setMwGlobals in tests.

Change-Id: Ifd7bd498bbb9a405afd9f6dd0e80540412b6ff93
2024-04-10 20:05:26 +00:00
Umherirrender bbb00c0f2d build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: Ied844c3ae930a03ca49e36e9a9e9d0c008d2634c
2024-03-11 20:13:21 +01:00
Umherirrender 15dbbe94d5 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: Ie00aedfe607665e8a38ee4ce2475f25b82a1d8cf
2024-01-05 22:37:40 +01:00
jenkins-bot 04eca18ed1 Merge "Use a return type hint for PageImages::getPageImageInternal()" 2023-11-30 10:36:46 +00:00
gerritbot e2986d0527 Update UserOptionsLookup's FQN
User-options related classes are being moved to the MediaWiki\User\Options namespace in MediaWiki Core; reflect that change here.

Bug: T352284
Depends-On: I9822eb1553870b876d0b8a927e4e86c27d83bd52
Change-Id: I50d14c08f9d10c5fc7aee2a3908c7ed1d9fad050
2023-11-29 12:39:39 +00:00
Fomafix 4b86859269 Use a return type hint for PageImages::getPageImageInternal()
Now getPageImageInternal returns null instead of false.

Fix the comment in fetchPageImage(): false means no cache.

Also add a return type hint to PageImages::factory().

Change-Id: I696f24390be530e7eea21957e0e46752d1bb3030
2023-10-21 13:06:16 +00:00
Fomafix 318407932c Replace deprecated global function wfGetDB()
Bug: T330641
Change-Id: If0427da7a6d2de9d1ec00bf1ff7e5b8a495617e9
2023-10-15 18:50:46 +00:00
Fomafix 029af825a9 Inject service RepoGroup in PageImages
Change-Id: I91d12fe25fbd6ee952d635cd24b5047be8790c80
2023-10-15 18:33:00 +00:00
Fomafix 1f95b141a6 Convert PageImages::fetchPageImage to a nonstatic method
The public static function PageImages::getPageImage must stay unchanged
because this function is called by other extensions.

Change-Id: I73f7253581ebc894ef6dcd41bd4713f7d9f53421
2023-10-15 18:21:40 +00:00
Umherirrender b8dd616a03 Use namespaced MediaWiki\Request\FauxRequest
Bug: T321681
Change-Id: I9c6b8bfc935a47c62c3e106a1bf4532ef4d12134
2023-08-20 01:54:45 +02:00
gerritbot a85ae32a5e Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I80f2f9cdd569d549de8b403226000bb5c88fcb67
2023-08-19 04:18:19 +00:00
Umherirrender 7f3a11f327 Use HookHandlers for MobileFrontend hook
Bug: T271021
Change-Id: I9293e1fee102b9a4274ef460b9c7556e0c7c6f6a
2023-08-15 10:03:09 +02:00
Timo Tijhof d50f90ba78 Adopt getWithSet idiom for getPageImage in-process cache
Follows-up I9b08b4de2648bf.

Bug: T322528
Change-Id: I8e974b66e3a0cdee2c6ef5eeb38719cff60dc93c
2022-11-23 01:38:14 +00:00
Amir Sarabadani bb555ae71d Add in-process cache for result of getPageImage() DB query
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
2022-11-15 20:18:43 +01:00
Umherirrender c24081b609 Inject services into hook handler
Remove the self creating of the handler and remove one deep from the
caller stack

Change-Id: Ie12ff77781f5ec6c74d9289a9812ec4f40c07d95
2022-09-03 00:15:57 +02:00
Sébastien Beyou 3ab47c1061 Add a parameter to deactivate OpenGraph meta tags
This can conflict with other extensions like SemanticMetaTags or
OpenGraphMeta.

Bug: T217307
Change-Id: Idfb006583edda8545b95609f047b2f301a9caa33
2022-08-20 09:43:57 +02:00
Reedy 84861174bc Convert Hooks to HookHandlers
Bug: T271021
Change-Id: I6022e515cf65ec089c59fb56f6fde371dc9f0e12
2022-07-07 10:21:43 +00:00
Roman Stolar 19729997d5 Avoid using User::getOption
Remove using of User:getOption since this method will be hard-deprecated. Now it is soft-deprecated

Bug: T296083
Change-Id: Ia6c2fb8a4510cc55e424fc23816e71b2b93732b4
2021-11-25 13:04:14 +02:00
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
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
DannyS712 a135c78cca Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: Icfccaa7795cd672c4f484377a33f7f62e37a7ffb
2020-05-19 23:27:50 +00: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
Umherirrender 2775a9fa66 Use MediaWikiServices::getRepoGroup
This required MediaWiki 1.34

Change-Id: I90df4bcce40abbe8a1365cd1d65af0c23cf595bd
2020-04-12 00:23:49 +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
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
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
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 fe1aad4adf Re-enable "MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" sniff
Bug: T170583
Change-Id: I33b56a824d26feb208492e8623c3c654a1372c47
2017-12-06 17:48:13 -05:00
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