Commit graph

716 commits

Author SHA1 Message Date
jenkins-bot e588a4eeff Merge "Add in-process cache for result of getPageImage() DB query" 2022-11-17 16:21:41 +00:00
libraryupgrader d99802768c build: Updating mediawiki/mediawiki-codesniffer to 40.0.1
Change-Id: Idfb908cfb13308c1c3a600705b0ed60d9215008f
2022-11-17 07:15:05 +00:00
Matthias Mullie c75b00d14d Ensure array is passed to getProperties
PageImages::getPropNames can return either array or string,
and PageProps::getProperties accepts both.
But the latter's return value will be different depending
on the type of input: with an array as input, the returned
array's values will be an associative array where the index
is the propname; with a string, it's just the propvalue.

This difference matters because the code below assumes an
array with propname keys.

Bug: T323152
Change-Id: I422951ec0cd5c651b32c65e88a557d49f2f22712
2022-11-16 09:33:37 +01: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
Matthias Mullie 9391a1f18c Remove size check
Size is not a useful (and thus far, unused) value that
is expensive to compute & we want to get rid of.

Let's not expect any particular value (or it even
existing) because that may not remain true for much longer.

Bug: T323125
Change-Id: I20d5c4358e225be7759ed38afb2267d6f811fa34
2022-11-15 18:39:22 +01:00
jenkins-bot d7d9c0275f Merge "Only provide free images for search purposes" 2022-11-10 17:48:20 +00:00
Matthias Mullie 5dcd4d13e2 Only provide free images for search purposes
Bug: T320661
Change-Id: Ic26e7e815365f6aa81b6fbfb464d0f41b80e4ae8
2022-11-10 13:26:56 +01:00
Tim Starling 33ee32f448 Use preg_replace_callback() flag introduced in PHP 7.4
Should improve performance by avoiding the need to run the regex
twice.

Change-Id: Ic737c1c2189c1bfc046cdcb099cdcbc0edde0a97
2022-11-10 13:58:31 +11:00
libraryupgrader fd123da0a3 build: Updating minimatch to 3.0.8
* https://github.com/advisories/GHSA-f8q6-p94x-37v3

Change-Id: Ic00d887ef92f96a6e3bb5d680328f39a61d4deec
2022-10-21 10:46:26 +00:00
libraryupgrader f807a8bbf0 build: Updating mediawiki/mediawiki-phan-config to 0.12.0
Change-Id: Ibd1a0df2c1786ccd45554ddf150602af681c6247
2022-10-09 08:12:35 +00:00
libraryupgrader dc2efbb7f4 build: Updating grunt-banana-checker to 0.10.0
Change-Id: Id8357b68ffcf2c2cb46c938bc689da64778803f4
2022-10-07 02:59:39 +00:00
jenkins-bot 74ec9b8a18 Merge "Drop some code that now lives in core" 2022-10-03 11:30:52 +00:00
Translation updater bot 105d05ccf8 Localisation updates from https://translatewiki.net.
Change-Id: I37ceba59fa2150345fc6b0eb3cf64599d323800f
2022-09-30 08:54:35 +02: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
Translation updater bot 2df53d17db Localisation updates from https://translatewiki.net.
Change-Id: If0165504c77b31bf09be7b78477938a41f21f856
2022-09-26 08:15:57 +02:00
jenkins-bot 499ffd7934 Merge "Inject services into hook handler" 2022-09-09 16:43:49 +00:00
jenkins-bot bfdd3d028d Merge "Inline ParserFileProcessingHookHandlers::processFile" 2022-09-09 16:39:10 +00:00
jenkins-bot 630decba6a Merge "Update hook FQCN" 2022-09-05 19:53:20 +00:00
jenkins-bot d6a007ebd1 Merge "Allow thumbnails to be provided in a different size" 2022-09-05 19:53:10 +00:00
Translation updater bot e6a81a9072 Localisation updates from https://translatewiki.net.
Change-Id: If90d51c7d2e6cb54536b9f4e330cb8a2912f3921
2022-09-05 10:11:36 +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
Umherirrender 3a8221b364 Inline ParserFileProcessingHookHandlers::processFile
There is only one caller,
this also benefits from the type hints on that caller and
some always-false condition could be removed

Change-Id: Id06b590225b3cf3f0baf331f0aaaad9ef522532a
2022-09-02 23:52:59 +02:00
Matthias Mullie 2d95a2be65 Update hook FQCN
This hook has moved.

Depends-On: Ic9110345b4db69d268685b80ec8e4e33da95a050
Change-Id: I71bddf3978a5b6124bdd114fcb74fbabe607a64a
Bug: T306883
2022-09-01 14:39:37 +02:00
Matthias Mullie a8c8030299 Allow thumbnails to be provided in a different size
This will also be added to the interface, but first this
implementation needs to be updated to already accept the
optional new param. Doing it in different order would
cause incompatible declaration warnings.

Bug: T306883
Change-Id: Ia30afcc43a0ecec772cd0a82dd9661e61f31a651
2022-09-01 12:29:41 +00: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 8adbbf5b8c
SearchResultProvideThumbnailHookHandler: Simplify code
Bug: T312746
Change-Id: Iaf3f7f56129f488088f08f65657fa33f6a6e5851
2022-07-18 10:13:42 +02:00
Kosta Harlan c7054f15c6
SearchResultProvideThumbnailHookHandler: Construct from injected services
Bug: T312746
Change-Id: I0ed66f69a4ae9350b2230b5e207a76bbcf5bb689
2022-07-11 15:12:17 +02:00
jenkins-bot debf0dab8f Merge "PageImageCandidate: Cast handlerWidth to int" 2022-07-08 18:21:37 +00:00
jenkins-bot e9c1b9fd32 Merge "Convert Hooks to HookHandlers" 2022-07-08 18:20:13 +00:00
Umherirrender 5ab11af559 Replace comment about deprecated wfFindFile
Bug: T249020
Change-Id: I202bf65e132389fb3d034524b546c4b03adc01db
2022-07-07 22:04:36 +02:00
Reedy 7e8167f3be PageImageCandidate: Cast handlerWidth to int
Bug: T312522
Change-Id: Iaf93f81acb28daa177c73de298bc9da47f2893d5
2022-07-07 11:23:24 +01:00
Reedy 84861174bc Convert Hooks to HookHandlers
Bug: T271021
Change-Id: I6022e515cf65ec089c59fb56f6fde371dc9f0e12
2022-07-07 10:21:43 +00:00
Reedy 5b0cc4163c PageImageCandidate: Apply array return type to jsonSerialize()
Bug: T311676
Change-Id: Ibf65ec1e12b746bb234f888aa4ca3820ae0f6974
2022-06-30 01:06:56 +01:00
Translation updater bot 40133efc14 Localisation updates from https://translatewiki.net.
Change-Id: Icd7b1137db11fdc992bf51036e3f6275e2720d78
2022-06-29 08:35:30 +02:00
Translation updater bot 061e159118 Localisation updates from https://translatewiki.net.
Change-Id: I7b9e486905a58575334a01696945cb4310c2dba6
2022-06-08 08:27:42 +02:00
libraryupgrader 6d7433a0c9 build: Updating grunt to 1.5.3
Change-Id: I2f2c03a2bf454188180e3accc7a422e2e361a5c4
2022-05-26 20:25:15 +00:00
libraryupgrader d1d1ad176b build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 38.0.0 → 39.0.0
* mediawiki/mediawiki-phan-config: 0.11.0 → 0.11.1
* php-parallel-lint/php-console-highlighter: 0.5.0 → 1.0.0
* php-parallel-lint/php-parallel-lint: 1.3.1 → 1.3.2

npm:
* eslint-config-wikimedia: 0.20.0 → 0.22.1
* grunt: 1.4.0 → 1.5.2
* grunt-eslint: 23.0.0 → 24.0.0
* async: 3.2.0 → 3.2.3
  * https://github.com/advisories/GHSA-fwr7-v2mv-hh25

Additional changes:
* Set `name` in package.json.

Change-Id: I41174721934d271f34bcf8e8cdd322a9eae3cae0
2022-05-21 09:06:38 +00:00
gerritbot d0f26549f2 Fix usage of ApiBase::PARAM_* deprecated constants
The ones that are replaced with ParamValidator

Bug: T275455
Change-Id: Ie88e576d3a6dc61155f2b7f49e86a993c2577427
2022-04-04 00:32:20 +00:00
gerritbot c2ee690bdd Replace deprecated ApiBase::PARAM_ with IntegerDef ones
The rest of ApiBase::PARAM_  will be done in separate patches

Bug: T275455
Change-Id: Ia64fadade6a890827bfb2b220e430c16716e86f7
2022-04-03 22:16:07 +02:00
Translation updater bot eb6e3ae4ca Localisation updates from https://translatewiki.net.
Change-Id: I38bbf70b0bb505ca39f0f8360be928ed75c8edaa
2022-03-04 08:29:55 +01:00
Translation updater bot 546144de52 Localisation updates from https://translatewiki.net.
Change-Id: I025e112657cceaefcc09d56bbb66c8559e9f02c2
2022-02-25 09:45:01 +01:00
C. Scott Ananian 8d62412484 ParserOutput::getPageProperty() now returns null when key is missing.
The return value of ParserOutput::getPageProperty() has transitioned
to returning `null` instead of `false` when the page property is missing.

Bug: T301915
Depends-On: Iaa25c390118d2db2b6578cdd558f2defd5351d15
Change-Id: Ie746883bd14eb579b40390d5fe824a5c6f93fa1e
2022-02-16 18:37:52 -05:00
C. Scott Ananian e9b268827f Update uses of ParserOutput::getPageProperty() to handle new return value
The return value of ParserOutput::getPageProperty() will transition to
returning `null` instead of `false` when the page property is missing.

Bug: T301915
Change-Id: I383abb6b7dc5e96c0061af13957609f6e31a1065
2022-02-16 18:37:52 -05:00
Simon Legner 41f4165230 Allow editors control of the page image
- Exclude images with class=notpageimage

Bug: T301588
Change-Id: I15eb580f5047a414431a45acf4004344e01a5881
2022-02-14 18:53:57 +00:00
jenkins-bot 69f7d0d2f8 Merge "Add more integrated parser test" 2022-02-03 20:21:48 +00:00
Translation updater bot 0f40df0326 Localisation updates from https://translatewiki.net.
Change-Id: I427cb3bbd02a7813182172fef37c94641bc34265
2022-02-01 08:27:20 +01:00
Translation updater bot fc80ededda Localisation updates from https://translatewiki.net.
Change-Id: Ibbfa09b2d1e730ca9341276eda20ee212d26b886
2022-01-28 08:34:18 +01:00
Translation updater bot 087b6d1304 Localisation updates from https://translatewiki.net.
Change-Id: I810690f08fa7e389c032cb1317ca516a98b39320
2022-01-27 08:39:10 +01: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 cf7a366089 Fix the case where there are no section headers
Bug: T299798
Change-Id: Ib5b25dbaece5c9ac5de665f4c990d053e8d9d440
2022-01-24 12:00:24 +11:00