Commit 7679f753 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

Merge branch 'bugfix/put-empty-distribution-image-field-into-xml' into 'develop'

Add distribution image files as empty xml entity if no given

See merge request !660
parents e0d52181 04d0d322
Pipeline #11553 passed with stages
in 5 minutes and 34 seconds
......@@ -142,29 +142,31 @@ class ExtensionIndexService implements LoggerAwareInterface
$reviewState = (string)((int)$extensionVersionArr['review_state'] !== -2 ? $extensionVersionArr['review_state'] : 0);
$versionObj->appendChild(new \DOMElement('reviewstate', $reviewState));
$versionObj->appendChild(new \DOMElement('category', $this->xmlentities((string)$extensionVersionArr['em_category'])));
$distributionImageUrl = '';
$distributionWelcomeImageUrl = '';
if ($extensionVersionArr['em_category'] === 'distribution') {
$prefixDistributionFilePath = $extensionKey[0] . '/' . $extensionKey[1] . '/' . $extensionKey . '_' . $versionNumber . '_';
$distributionImage = $prefixDistributionFilePath . 'Distribution.png';
$distributionWelcomeImage = $prefixDistributionFilePath . 'DistributionWelcome.png';
if (is_file($this->basePath . $distributionImage)) {
$distributionImageUrl = $distributionBaseUrl . $distributionImage;
$versionObj->appendChild(
new \DOMElement(
'distributionImage',
$this->xmlentities($distributionImageUrl)
)
);
}
if (is_file($this->basePath . $distributionWelcomeImage)) {
$distributionWelcomeImageUrl = $distributionBaseUrl . $distributionWelcomeImage;
$versionObj->appendChild(
new \DOMElement(
'distributionImageWelcome',
$this->xmlentities($distributionWelcomeImageUrl)
)
);
}
}
$versionObj->appendChild(
new \DOMElement(
'distributionImage',
$this->xmlentities($distributionImageUrl)
)
);
$versionObj->appendChild(
new \DOMElement(
'distributionImageWelcome',
$this->xmlentities($distributionWelcomeImageUrl)
)
);
$versionObj->appendChild(
new \DOMElement(
'downloadcounter',
......
......@@ -35,6 +35,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/>
<reviewstate>0</reviewstate>
<category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/>
<lastuploaddate/>
<uploadcomment/>
......@@ -56,6 +58,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/>
<reviewstate>0</reviewstate>
<category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/>
<lastuploaddate/>
<uploadcomment/>
......@@ -77,6 +81,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/>
<reviewstate>0</reviewstate>
<category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/>
<lastuploaddate/>
<uploadcomment/>
......@@ -98,6 +104,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/>
<reviewstate>-1</reviewstate>
<category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/>
<lastuploaddate/>
<uploadcomment/>
......@@ -119,6 +127,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/>
<reviewstate>0</reviewstate>
<category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/>
<lastuploaddate/>
<uploadcomment/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment