Commit ba4a575f authored by Thomas Löffler's avatar Thomas Löffler

Checks every version of extension for LTS support

parent c755d1df
Pipeline #3027 passed with stages
in 4 minutes and 59 seconds
......@@ -245,7 +245,7 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
/**
* Getter for versions
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Version> Versions
* @return Version[]|\TYPO3\CMS\Extbase\Persistence\ObjectStorage<\T3o\TerFe2\Domain\Model\Version>
*/
public function getVersions(): ObjectStorage
{
......
......@@ -1168,7 +1168,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$supportedTypo3Versions = [];
foreach ($typo3Versions as $label => $mainVersion) {
$supportedTypo3Versions[$label] = \T3o\TerFe2\Utility\VersionUtility::doesExtensionVersionSupportTypo3Version($this, $mainVersion);
$supportedTypo3Versions[$label] = \T3o\TerFe2\Utility\VersionUtility::doesExtensionSupportTypo3Version($this->getExtension(), $mainVersion);
}
return $supportedTypo3Versions;
......
......@@ -103,15 +103,16 @@ class TerIndexer extends \ApacheSolrForTypo3\Solr\IndexQueue\Indexer
// does this extension supports different versions?
// @todo: use JSON with all versions to get them
$lastVersion = $extension->getLastVersion();
$document->setField('supports7_boolS', VersionUtility::doesExtensionVersionSupportTypo3Version($lastVersion, 7006000));
$document->setField('supports8_boolS', VersionUtility::doesExtensionVersionSupportTypo3Version($lastVersion, 8007000));
$document->setField('supports7_boolS', false);
$document->setField('supports8_boolS', false);
$typo3Support = [];
if (VersionUtility::doesExtensionVersionSupportTypo3Version($lastVersion, 7006000)) {
if (VersionUtility::doesExtensionSupportTypo3Version($extension, 7006000)) {
$typo3Support[] = '7 LTS';
$document->setField('supports7_boolS', true);
}
if (VersionUtility::doesExtensionVersionSupportTypo3Version($lastVersion, 8007000)) {
if (VersionUtility::doesExtensionSupportTypo3Version($extension, 8007000)) {
$typo3Support[] = '8 LTS';
$document->setField('supports8_boolS', true);
}
$document->setField('typo3support_stringM', $typo3Support);
......
......@@ -42,19 +42,27 @@ class VersionUtility
}
/**
* @param \T3o\TerFe2\Domain\Model\Version $version
* @param \T3o\TerFe2\Domain\Model\Extension $extension
* @param int $mainVersion
* @return bool
*/
public static function doesExtensionVersionSupportTypo3Version(\T3o\TerFe2\Domain\Model\Version $version, int $mainVersion): bool
public static function doesExtensionSupportTypo3Version(\T3o\TerFe2\Domain\Model\Extension $extension, int $mainVersion): bool
{
if (empty($version->getTypo3Dependency())) {
return false;
}
foreach ($extension->getVersions() as $version) {
if ($version->getTypo3Dependency() === null || $version->getReviewState() < 0) {
  • IMO, we should get accessors for this information (e.g. hasTypo3Dependency() and isLive() or so), otherwise we have to use that magic info everywhere…

Please register or sign in to reply
continue;
}
// reset from e.g. 7.6.21 to 7.6.0 for valid check
$resetMinimumVersion = (int)($version->getTypo3Dependency()->getMinimumVersion() / 1000) * 1000;
// reset from e.g. 7.6.21 to 7.6.0 for valid check
$resetMinimumVersion = (int)($version->getTypo3Dependency()->getMinimumVersion() / 1000) * 1000;
$supportsTypo3Version = $resetMinimumVersion <= $mainVersion && $version->getTypo3Dependency()->getMaximumVersion() >= $mainVersion;
if ($supportsTypo3Version) {
return true;
}
}
return $resetMinimumVersion <= $mainVersion && $version->getTypo3Dependency()->getMaximumVersion() >= $mainVersion;
return false;
}
}
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