jenkins-bot has submitted this change and it was merged.

Change subject: Fix PHP notices complaining about missing array indices
......................................................................


Fix PHP notices complaining about missing array indices

Bug: 71793
Change-Id: Iaa1b01d9a1d4adde637676226c42f1471112db79
---
M DataCollector.php
1 file changed, 12 insertions(+), 3 deletions(-)

Approvals:
  Gergő Tisza: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/DataCollector.php b/DataCollector.php
index 373d38d..bc2f8f5 100755
--- a/DataCollector.php
+++ b/DataCollector.php
@@ -125,9 +125,18 @@
        protected function getTemplateMetadata( $templateData ) {
                // GetExtendedMetadata does not handle multivalued fields, we 
need to select one of everything
                $templateFields = array();
-               $templateFields = array_merge( $templateFields, 
$this->selectCoordinate( $templateData[TemplateParser::COORDINATES_KEY] ) );
-               $templateFields = array_merge( $templateFields, 
$this->selectInformationTemplate( 
$templateData[TemplateParser::INFORMATION_FIELDS_KEY] ) );
-               $templateFields = array_merge( $templateFields, 
$this->selectLicense( $templateData[TemplateParser::LICENSES_KEY] ) );
+
+               if ( isset( $templateData[TemplateParser::COORDINATES_KEY] ) ) {
+                       $templateFields = array_merge( $templateFields, 
$this->selectCoordinate( $templateData[TemplateParser::COORDINATES_KEY] ) );
+               }
+
+               if ( isset( 
$templateData[TemplateParser::INFORMATION_FIELDS_KEY] ) ) {
+                       $templateFields = array_merge( $templateFields, 
$this->selectInformationTemplate( 
$templateData[TemplateParser::INFORMATION_FIELDS_KEY] ) );
+               }
+
+               if ( isset( $templateData[TemplateParser::LICENSES_KEY] ) ) {
+                       $templateFields = array_merge( $templateFields, 
$this->selectLicense( $templateData[TemplateParser::LICENSES_KEY] ) );
+               }
 
                $metadata = array();
                foreach( $templateFields as $name => $value ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa1b01d9a1d4adde637676226c42f1471112db79
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CommonsMetadata
Gerrit-Branch: REL1_24
Gerrit-Owner: Unicodesnowman <[email protected]>
Gerrit-Reviewer: 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

Reply via email to