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 ...@@ -142,29 +142,31 @@ class ExtensionIndexService implements LoggerAwareInterface
$reviewState = (string)((int)$extensionVersionArr['review_state'] !== -2 ? $extensionVersionArr['review_state'] : 0); $reviewState = (string)((int)$extensionVersionArr['review_state'] !== -2 ? $extensionVersionArr['review_state'] : 0);
$versionObj->appendChild(new \DOMElement('reviewstate', $reviewState)); $versionObj->appendChild(new \DOMElement('reviewstate', $reviewState));
$versionObj->appendChild(new \DOMElement('category', $this->xmlentities((string)$extensionVersionArr['em_category']))); $versionObj->appendChild(new \DOMElement('category', $this->xmlentities((string)$extensionVersionArr['em_category'])));
$distributionImageUrl = '';
$distributionWelcomeImageUrl = '';
if ($extensionVersionArr['em_category'] === 'distribution') { if ($extensionVersionArr['em_category'] === 'distribution') {
$prefixDistributionFilePath = $extensionKey[0] . '/' . $extensionKey[1] . '/' . $extensionKey . '_' . $versionNumber . '_'; $prefixDistributionFilePath = $extensionKey[0] . '/' . $extensionKey[1] . '/' . $extensionKey . '_' . $versionNumber . '_';
$distributionImage = $prefixDistributionFilePath . 'Distribution.png'; $distributionImage = $prefixDistributionFilePath . 'Distribution.png';
$distributionWelcomeImage = $prefixDistributionFilePath . 'DistributionWelcome.png'; $distributionWelcomeImage = $prefixDistributionFilePath . 'DistributionWelcome.png';
if (is_file($this->basePath . $distributionImage)) { if (is_file($this->basePath . $distributionImage)) {
$distributionImageUrl = $distributionBaseUrl . $distributionImage; $distributionImageUrl = $distributionBaseUrl . $distributionImage;
}
if (is_file($this->basePath . $distributionWelcomeImage)) {
$distributionWelcomeImageUrl = $distributionBaseUrl . $distributionWelcomeImage;
}
}
$versionObj->appendChild( $versionObj->appendChild(
new \DOMElement( new \DOMElement(
'distributionImage', 'distributionImage',
$this->xmlentities($distributionImageUrl) $this->xmlentities($distributionImageUrl)
) )
); );
}
if (is_file($this->basePath . $distributionWelcomeImage)) {
$distributionWelcomeImageUrl = $distributionBaseUrl . $distributionWelcomeImage;
$versionObj->appendChild( $versionObj->appendChild(
new \DOMElement( new \DOMElement(
'distributionImageWelcome', 'distributionImageWelcome',
$this->xmlentities($distributionWelcomeImageUrl) $this->xmlentities($distributionWelcomeImageUrl)
) )
); );
}
}
$versionObj->appendChild( $versionObj->appendChild(
new \DOMElement( new \DOMElement(
'downloadcounter', 'downloadcounter',
......
...@@ -35,6 +35,8 @@ class ExtensionIndexServiceTest extends UnitTestCase ...@@ -35,6 +35,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/> <state/>
<reviewstate>0</reviewstate> <reviewstate>0</reviewstate>
<category/> <category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/> <downloadcounter/>
<lastuploaddate/> <lastuploaddate/>
<uploadcomment/> <uploadcomment/>
...@@ -56,6 +58,8 @@ class ExtensionIndexServiceTest extends UnitTestCase ...@@ -56,6 +58,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/> <state/>
<reviewstate>0</reviewstate> <reviewstate>0</reviewstate>
<category/> <category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/> <downloadcounter/>
<lastuploaddate/> <lastuploaddate/>
<uploadcomment/> <uploadcomment/>
...@@ -77,6 +81,8 @@ class ExtensionIndexServiceTest extends UnitTestCase ...@@ -77,6 +81,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/> <state/>
<reviewstate>0</reviewstate> <reviewstate>0</reviewstate>
<category/> <category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/> <downloadcounter/>
<lastuploaddate/> <lastuploaddate/>
<uploadcomment/> <uploadcomment/>
...@@ -98,6 +104,8 @@ class ExtensionIndexServiceTest extends UnitTestCase ...@@ -98,6 +104,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/> <state/>
<reviewstate>-1</reviewstate> <reviewstate>-1</reviewstate>
<category/> <category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/> <downloadcounter/>
<lastuploaddate/> <lastuploaddate/>
<uploadcomment/> <uploadcomment/>
...@@ -119,6 +127,8 @@ class ExtensionIndexServiceTest extends UnitTestCase ...@@ -119,6 +127,8 @@ class ExtensionIndexServiceTest extends UnitTestCase
<state/> <state/>
<reviewstate>0</reviewstate> <reviewstate>0</reviewstate>
<category/> <category/>
<distributionImage/>
<distributionImageWelcome/>
<downloadcounter/> <downloadcounter/>
<lastuploaddate/> <lastuploaddate/>
<uploadcomment/> <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