Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/92537


Change subject: Make sure CMD doesn't overwrite itself
......................................................................

Make sure CMD doesn't overwrite itself

This fixes some issues when CMD is installed both on the repo and on
the local wiki, and repo data is overwritten with inferior local data.

Change-Id: I9d5ad481cc04c1d43d1b512586c0284094d00455
---
M CommonsMetadata_body.php
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CommonsMetadata 
refs/changes/37/92537/1

diff --git a/CommonsMetadata_body.php b/CommonsMetadata_body.php
index 49fe059..f60ad97 100755
--- a/CommonsMetadata_body.php
+++ b/CommonsMetadata_body.php
@@ -54,6 +54,18 @@
        public static function onGetExtendedMetadata( &$combinedMeta, File 
$file, IContextSource $context, $singleLang, &$maxCache ) {
                $lang = $context->getLanguage();
 
+               if ( isset( $combinedMeta['CommonsMedadataExtension'] ) ) {
+                       // this is a file from a remote repo, and 
CommonsMedadata is installed on
+                       // the remote as well. We assume data collected at the 
repo is superior
+                       // to what we could collect here, so don't do anything.
+                       return true;
+               } else {
+                       $combinedMeta['CommonsMedadataExtension'] = array(
+                               'value' => 1,
+                               'source' => 'extension',
+                       );
+               }
+
                # Note: If this is a local file, there is no caching here.
                # However, the results of this module have longer caching for 
local
                # files to help compensate. For foreign files, this method is 
cached

-- 
To view, visit https://gerrit.wikimedia.org/r/92537
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d5ad481cc04c1d43d1b512586c0284094d00455
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CommonsMetadata
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to