jenkins-bot has submitted this change and it was merged.
Change subject: Add a flag to force local recalculation of the metadata
......................................................................
Add a flag to force local recalculation of the metadata
Bug: T70687
Change-Id: I721dfcdb283b81c63cc4241786f593b1e5dcd065
---
M CommonsMetadata.php
M HookHandler.php
2 files changed, 15 insertions(+), 0 deletions(-)
Approvals:
Gilles: Looks good to me, approved
jenkins-bot: Verified
diff --git a/CommonsMetadata.php b/CommonsMetadata.php
index 5db1c83..58b89d9 100644
--- a/CommonsMetadata.php
+++ b/CommonsMetadata.php
@@ -31,6 +31,18 @@
*/
$wgCommonsMetadataSetTrackingCategories = false;
+/**
+ * Normally, when CommonsMetadata processes a file from a foreign image
repository
+ * (such as InstantCommons) and that repository has the same version of
CommonsMetadata
+ * installed, the local extension will reuse the output of the remote one
instead of processing
+ * the file page text directly. If this flag is set to true, the local
extension will always
+ * calculate the metadata from scratch. This is intended for use in
testing/development setups.
+ *
+ * This does NOT disable local metadata caching.
+ * @var bool
+ */
+$wgCommonsMetadataForceRecalculate = false;
+
$wgAutoloadClasses['CommonsMetadata\HookHandler'] = __DIR__ .
'/HookHandler.php';
$wgAutoloadClasses['CommonsMetadata\DataCollector'] = __DIR__ .
'/DataCollector.php';
$wgAutoloadClasses['CommonsMetadata\DomNavigator'] = __DIR__ .
'/DomNavigator.php';
diff --git a/HookHandler.php b/HookHandler.php
index 40e7ea6..3299791 100644
--- a/HookHandler.php
+++ b/HookHandler.php
@@ -28,9 +28,12 @@
* @return bool this hook handler always returns true.
*/
public static function onGetExtendedMetadata( &$combinedMeta, \File
$file, \IContextSource $context, $singleLang, &$maxCache ) {
+ global $wgCommonsMetadataForceRecalculate;
+
if (
isset(
$combinedMeta['CommonsMetadataExtension']['value'] )
&& $combinedMeta['CommonsMetadataExtension']['value']
== self::VERSION
+ && !$wgCommonsMetadataForceRecalculate
) {
// This is a file from a remote API repo, and
CommonsMetadata is installed on
// the remote as well, and generates the same metadata
format. We have nothing to do.
--
To view, visit https://gerrit.wikimedia.org/r/177016
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I721dfcdb283b81c63cc4241786f593b1e5dcd065
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CommonsMetadata
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits