Commit graph

44 commits

Author SHA1 Message Date
Fomafix 029af825a9 Inject service RepoGroup in PageImages
Change-Id: I91d12fe25fbd6ee952d635cd24b5047be8790c80
2023-10-15 18:33:00 +00:00
James D. Forrester 1a8a759d4e build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I43f3097112be450202cdaf7326daeae388e16e6d
2023-08-19 13:58:01 +08:00
Umherirrender 7f3a11f327 Use HookHandlers for MobileFrontend hook
Bug: T271021
Change-Id: I9293e1fee102b9a4274ef460b9c7556e0c7c6f6a
2023-08-15 10:03:09 +02:00
Umherirrender 619d623104 ParserFileProcessing: Inject TitleFactory
Check the parsed title if valid and can exists on the database

Change-Id: I32805de6ab4b9dca7d56faf982762f6949fc3203
2023-06-21 23:03:44 +02:00
Umherirrender a9b4b4877f ParserFileProcessing: Use ConnectionProvider and QueryBuilder
Bug: T312501
Change-Id: I4c5b5b773cbf1bf77dae7c189f65c8760091e384
2023-06-21 22:50:19 +02:00
Umherirrender 3ae938a116 Use renamed ParserModifyImageHTMLHook interface
Follow-Up: I3043454a502289e5ee2492f7bf2ab01e155c30ba
Change-Id: I3cc4a5d4e4edac76e81c16c1da97427d765cce49
2023-04-22 19:54:54 +02:00
Umherirrender de7bf883d2 Replace deprecated Http::get
Bug: T305813
Change-Id: Icd3e64fc13e291761b287c4059315df39cd88d1e
2022-12-11 15:54:20 +01:00
jenkins-bot 74ec9b8a18 Merge "Drop some code that now lives in core" 2022-10-03 11:30:52 +00:00
Matthias Mullie 6a6af45ab3 Drop some code that now lives in core
The default thumbnail size (SearchResultThumbnailProvider::THUMBNAIL_SIZE),
the code to build a SearchResultThumbnail object from a File object
(SearchResultThumbnailProvider::buildSearchResultThumbnailFromFile),
and the code that provides thumbnails from NS_FILE pages (now already
provided in the hook's $results param) have essentially been adopted
in core and no longer need to be handled here.

Also updated test to reflect that NS_FILE results will no longer be
provided by this extension (since core already provides them)

Depends-On: I2a679b51758020d3e822da01a1bde1ae632b0b0a
Change-Id: I2eafc8556022432929973755d8cd76010ea24f39
Bug: T306883
2022-09-27 10:46:14 +02: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
Kosta Harlan c7054f15c6
SearchResultProvideThumbnailHookHandler: Construct from injected services
Bug: T312746
Change-Id: I0ed66f69a4ae9350b2230b5e207a76bbcf5bb689
2022-07-11 15:12:17 +02:00
Reedy 84861174bc Convert Hooks to HookHandlers
Bug: T271021
Change-Id: I6022e515cf65ec089c59fb56f6fde371dc9f0e12
2022-07-07 10:21:43 +00:00
Tim Starling ccdb93f3c1 Add more integrated parser test
Including regression test for T299798.

Bug: T299798
Depends-On: Idc4ac4eb4e20d8e3e2fdbd093ff75f26d3af0d57
Change-Id: I89fa346651e756d1981a950a8b778020359b86a2
2022-01-24 14:00:27 +11:00
Tim Starling 768464d0f9 Identify lead images using a new parser hook instead of during LinksUpdate
I added ParserModifyImageHTML to core to make it easier for PageImages
to identify images in the lead section.

This also allows PageImages to stop writing to LinksUpdate properties.
It is one of only two extensions that do that.

Depends-On: I24528381e8d24ca8d138bceadb9397c83fd31356
Bug: T176520
Bug: T296895
Change-Id: I472f4a023969bfde6298eb56112c16d2ae842199
2022-01-04 14:19:32 +11:00
Simon Legner 6220277055 Fix typo in PageImagesScores description
Change-Id: Ica4ae8963f8b21b016ca96c4454c4e88fd353e30
2021-10-26 12:42:46 +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
Petr Pchelko a0d2696e69 Remove leftover SearchResultPageIdentity typehints
Change-Id: I7a1dfc26d0985e645c785297c849e4c2854c034b
2021-05-14 19:21:16 -07: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
Kunal Mehta 49e5f64c0a Use "description" in extension.json
Bug: T252589
Change-Id: I77d258b23ff8a01bf4fcb455914d6bb64338fc66
2020-05-12 12:53:29 -07: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 6452380305 Fix ParserMakeImageParams hook subscriber
Change-Id: Id5591e5cdc7efc6a7fd3f48f8ea99be65a3606f0
Follows-Up: I4a3fa5f8aaafd87c78b03f04369a73f4b4f1b189
Bug: T250745
2020-04-20 20:56:30 +01:00
Reedy 0a406c67a8 Add TestAutoloadNamespaces
Remove require_once from ApiQueryPageImagesTest

Change-Id: I0d1cf452a3c88e0cbac4c44284b7dc673bbca886
2020-04-19 23:14:24 +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
James D. Forrester 3caa4aaf28 Remove unused 'OpenSearchXml' hook handler
This is the equivalent of the current 'ApiOpenSearchSuggest' hook
as it once existed in the "OpenSearchXml" MediaWiki extension,
which merged into core and archived three years ago.

See also Ibe244851857ddff3a437acb12c3cc7660eb89089 in TextExtracts

Change-Id: Ifae845925692f2c1113896133e99901782126841
2019-12-20 16:55:15 +00:00
Alex Monk 378c5ab4cf Split apihelp messages to a separate file
Bug: T189982
Change-Id: Ibcd42f3d69843e22783507d790118d4ad0d159ad
2019-08-25 02:35:02 +01:00
Thiemo Kreuz baabc300ba Remove bogus @doc… elements from default $wgPageImagesScores setting
Such @doc… keys are not allowed at this level. They make it to the code
and cause confusion there. I added a test case for an edge case where this
really causes wrong results.

Bug: T212013
Change-Id: Ib391e5639ef5a34f9ee44f8c19b99e1dd19207bc
2019-01-09 12:41:21 +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
Umherirrender 557b7e7128 Require MediaWiki 1.29 in extension.json for manifest_version 2
manifest_version 2 is a new feature in 1.29
(Iea5ba589c70958db7500cf3587b5ebd738532026)

Change-Id: Ic0f1104e18866e14ea8c98b5a6a98fcb0410ecae
2018-02-03 10:46:26 +01:00
Pppery d81dfe6e9e Re-enable "MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" sniff
Bug: T170583
Change-Id: I76ed85cf960269c5692e9ec8c92877bcb13e4100
2017-12-07 14:02:09 +00:00
aude 97572615e0 Make PageImages default API license parameter configurable
Bug: T156190
Change-Id: Id4b43f2597d5a063dca0d46f308b6283620e9974
2017-05-20 17:36:56 +02:00
Zach 4c0e441833 Make PageImagesLeadSectionOnly default to true
Supporting changes:
* Update the LinksUpdateHookHandlerTest test case to set the config
  variable to its expected value of false.

Bug: T162203
Change-Id: Ic7b4d5ab42f71f6b4cf24cb5bbbbe808341a09e8
2017-04-18 10:16:22 +01:00
jenkins-bot 188f8d6020 Merge "UseGalleries is unused" 2017-04-10 21:43:02 +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 e5cbfdb221 Add PageImage OpenGraph tag
Bug: T101711
Bug: T142048
Bug: T51859
Change-Id: Idd9125ad06964f50cbad70283819107611cfec44
2017-01-30 22:24:02 +03:30
jdlrobson e44969eca0 UseGalleries is unused
Unless I'm mistaken this config variable has never been used
in this codebase since introduction in
I64e997d58e4a1b66a8a351d85a3e7df1a77354e9

It's not documented so not clear why it is needed
and not referenced in this codebase.

Change-Id: Ib227eefb77ba2719db277fa80a8bfb958ea6a778
2017-01-23 12:20:58 -08:00
jenkins-bot 4e9444f3f3 Merge "Restrict page images to lead section" 2016-12-08 19:26:39 +00:00
jdlrobson 00b9f9fdc4 Restrict page images to lead section
When $wgPageImagesLeadSectionOnly is true restrict
the scoring of page images to images in the lead section.
This results in an additional parse of the lead section of the
content, but this should only happen once after an edit
has occurred and is deferred.

If false all images will be considered as candidates for
the page image choice.

Note that the choice between modes is per site not by
request. This is intentional to avoid having to store 4
different properties respecting license and
article position. As a result when enabling or disabling
this switch on existing setups, there will be a transitional
period where pages previously parsed will show pageimages
as calculated by the previous value of this config variable.

Bug: T87336
Change-Id: I09bdae82515f6e93f5606553259f10b3a10e9eaa
2016-12-08 10:41:21 -08:00
Erik Bernhardson 03e14d0c86 Add job queue option for initImageData maintenance script
Trying to run this script in the cluster fatals out due to memory
problems somewhat regularly. The --start option helps to restart
it where it fell down, but when trying to run against hundreds of
wiki's that is a one-off solution that makes ensuring everything is
actually visited a pain.

To try and isolate errors add an option to push the parsing into the
job queue. There is still the possibility to miss pages, but job queue
retries should take care of us for the most part. Attempts to keep
load down on the databases by making sure no more than a specified
number of jobs are queued/processing at a given time.

Bug: T152155
Change-Id: I3a4e3a415b2f03de0bb36ac0515241e950130fde
2016-12-06 10:56:52 -08: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