Commit 8d562a17 authored by Thomas Löffler's avatar Thomas Löffler

Merge branch 'task/update-to-v9' into TYPO3V9/ter_fe2

parents 41f5c4b9 52c68d46
#ddev-generated: Automatically generated ddev .gitignore. #ddev-generated: Automatically generated ddev .gitignore.
# You can remove the above line if you want to edit and maintain this file yourself. # You can remove the above line if you want to edit and maintain this file yourself.
/commands/*/*.example
/commands/*/README.txt
/commands/db/mysql
/homeadditions/*.example
/homeadditions/README.txt
/import.yaml /import.yaml
/docker-compose.yaml /docker-compose.yaml
/db_snapshots /db_snapshots
...@@ -8,6 +13,10 @@ ...@@ -8,6 +13,10 @@
/import-db /import-db
/.bgsync* /.bgsync*
/config.*.y*ml /config.*.y*ml
/.webimageBuild
/.dbimageBuild
/.bgsyncimageBuild
/.sshimageBuild
/.webimageExtra /.webimageExtra
/.dbimageExtra /.dbimageExtra
/*-build/Dockerfile.example /*-build/Dockerfile.example
APIVersion: v1.9.1 APIVersion: v1.11.2
name: ter name: ter
type: typo3 type: typo3
docroot: public docroot: public
...@@ -25,11 +25,11 @@ use_dns_when_possible: true ...@@ -25,11 +25,11 @@ use_dns_when_possible: true
timezone: Europe/Berlin timezone: Europe/Berlin
# This config.yaml was created with ddev version v1.9.1 # This config.yaml was created with ddev version v1.11.2
# webimage: drud/ddev-webserver:v1.9.0 # webimage: drud/ddev-webserver:v1.11.0
# dbimage: drud/ddev-dbserver:v1.9.0-10.2 # dbimage: drud/ddev-dbserver:v1.11.0-10.2
# dbaimage: drud/phpmyadmin:v1.9.0 # dbaimage: drud/phpmyadmin:v1.11.0
# bgsyncimage: drud/ddev-bgsync:v1.9.0 # bgsyncimage: drud/ddev-bgsync:v1.11.0
# However we do not recommend explicitly wiring these images into the # However we do not recommend explicitly wiring these images into the
# config.yaml as they may break future versions of ddev. # config.yaml as they may break future versions of ddev.
# You can update this config.yaml using 'ddev config'. # You can update this config.yaml using 'ddev config'.
...@@ -43,7 +43,7 @@ timezone: Europe/Berlin ...@@ -43,7 +43,7 @@ timezone: Europe/Berlin
# docroot: <relative_path> # Relative path to the directory containing index.php. # docroot: <relative_path> # Relative path to the directory containing index.php.
# php_version: "7.1" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3" # php_version: "7.2" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4"
# You can explicitly specify the webimage, dbimage, dbaimage lines but this # You can explicitly specify the webimage, dbimage, dbaimage lines but this
# is not recommended, as the images are often closely tied to ddev's' behavior, # is not recommended, as the images are often closely tied to ddev's' behavior,
...@@ -58,9 +58,18 @@ timezone: Europe/Berlin ...@@ -58,9 +58,18 @@ timezone: Europe/Berlin
# router_https_port: <port> # Port for https (defaults to 443) # router_https_port: <port> # Port for https (defaults to 443)
# xdebug_enabled: false # Set to true to enable xdebug and "ddev start" or "ddev restart" # xdebug_enabled: false # Set to true to enable xdebug and "ddev start" or "ddev restart"
# Note that for most people the commands
# "ddev exec enable_xdebug" and "ddev exec disable_xdebug" work better,
# as leaving xdebug enabled all the time is a big performance hit.
# webserver_type: nginx-fpm # Can be set to apache-fpm or apache-cgi as well # webserver_type: nginx-fpm # Can be set to apache-fpm or apache-cgi as well
# timezone: Europe/Berlin
# This is the timezone used in the containers and by PHP;
# it can be set to any valid timezone,
# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# For example Europe/Dublin or MST7MDT
# additional_hostnames: # additional_hostnames:
# - somename # - somename
# - someothername # - someothername
...@@ -121,11 +130,9 @@ timezone: Europe/Berlin ...@@ -121,11 +130,9 @@ timezone: Europe/Berlin
# webimage_extra_packages: [php-yaml, php7.3-ldap] # webimage_extra_packages: [php-yaml, php7.3-ldap]
# Extra Debian packages that are needed in the webimage can be added here # Extra Debian packages that are needed in the webimage can be added here
# This is ignored if a free-form .ddev/web-build/Dockerfile is provided
# dbimage_extra_packages: [telnet,netcat] # dbimage_extra_packages: [telnet,netcat]
# Extra Debian packages that are needed in the dbimage can be added here # Extra Debian packages that are needed in the dbimage can be added here
# This is ignored if a free-form .ddev/db-build/Dockerfile is provided
# use_dns_when_possible: true # use_dns_when_possible: true
# If the host has internet access and the domain configured can # If the host has internet access and the domain configured can
...@@ -136,9 +143,10 @@ timezone: Europe/Berlin ...@@ -136,9 +143,10 @@ timezone: Europe/Berlin
# project_tld: ddev.site # project_tld: ddev.site
# The top-level domain used for project URLs # The top-level domain used for project URLs
# The default "ddev.site" allows DNS lookup via a wildcard # The default "ddev.site" allows DNS lookup via a wildcard
# For backward compatibility this can be changed to "ddev.local" # If you prefer you can change this to "ddev.local" to preserve
# pre-v1.9 behavior.
# ngrok_args: --subdomain mysite --auth "user:pass" # ngrok_args: --subdomain mysite --auth username:pass
# Provide extra flags to the "ngrok http" command, see # Provide extra flags to the "ngrok http" command, see
# https://ngrok.com/docs#http or run "ngrok http -h" # https://ngrok.com/docs#http or run "ngrok http -h"
...@@ -152,4 +160,4 @@ timezone: Europe/Berlin ...@@ -152,4 +160,4 @@ timezone: Europe/Berlin
# for them. Example: # for them. Example:
#hooks: #hooks:
# post-start: # post-start:
# - exec: composer install -d /var/www/html # - exec: composer install -d /var/www/html
\ No newline at end of file
...@@ -3,6 +3,4 @@ version: '3.6' ...@@ -3,6 +3,4 @@ version: '3.6'
services: services:
web: web:
environment: environment:
- TYPO3_CONTEXT=Development - TYPO3_CONTEXT=Development
- PHP_IDE_CONFIG="serverName=ter.ddev.local" \ No newline at end of file
- DEBIAN_FRONTEND=noninteractive
\ No newline at end of file
This diff is collapsed.
...@@ -362,7 +362,7 @@ class tx_ter_helper ...@@ -362,7 +362,7 @@ class tx_ter_helper
// Check if update of files requested // Check if update of files requested
$updateRequestedFile = $this->pluginObj->repositoryDir . 'extensions.xml.gz.needsupdate'; $updateRequestedFile = $this->pluginObj->repositoryDir . 'extensions.xml.gz.needsupdate';
if (@filemtime($updateRequestedFile) <= @filemtime($this->pluginObj->repositoryDir . 'extensions.xml.gz')) { if (file_exists($updateRequestedFile) && @filemtime($updateRequestedFile) <= @filemtime($this->pluginObj->repositoryDir . 'extensions.xml.gz')) {
return; return;
} }
...@@ -401,6 +401,7 @@ class tx_ter_helper ...@@ -401,6 +401,7 @@ class tx_ter_helper
$dom = new DOMDocument('1.0', 'utf-8'); $dom = new DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true; $dom->formatOutput = true;
$extensionsObj = $dom->appendChild(new DOMElement('extensions')); $extensionsObj = $dom->appendChild(new DOMElement('extensions'));
$documentationService = GeneralUtility::makeInstance(\T3o\TerFe2\Service\DocumentationService::class);
// Create the nested XML structure: // Create the nested XML structure:
foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) { foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) {
...@@ -412,6 +413,16 @@ class tx_ter_helper ...@@ -412,6 +413,16 @@ class tx_ter_helper
$this->xmlentities($extensionsTotalDownloadsArr[$extensionKey]) $this->xmlentities($extensionsTotalDownloadsArr[$extensionKey])
) )
); );
$extensionRecord = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
->getConnectionForTable('tx_terfe2_domain_model_extension')
->select(
['uid', 'external_manual'],
'tx_terfe2_domain_model_extension',
[
'ext_key' => $extensionKey
]
)
->fetch();
foreach ($extensionVersionsArr['versions'] as $versionNumber => $extensionVersionArr) { foreach ($extensionVersionsArr['versions'] as $versionNumber => $extensionVersionArr) {
$versionObj = $extensionObj->appendChild(new DOMElement('version')); $versionObj = $extensionObj->appendChild(new DOMElement('version'));
...@@ -463,6 +474,12 @@ class tx_ter_helper ...@@ -463,6 +474,12 @@ class tx_ter_helper
) )
); );
$versionObj->appendChild(new DOMElement('t3xfilemd5', $extensionVersionArr['t3xfilemd5'])); $versionObj->appendChild(new DOMElement('t3xfilemd5', $extensionVersionArr['t3xfilemd5']));
$documentationLink = '';
try {
$documentationLink = $documentationService->getDocumentationLink($extensionKey, $versionNumber, true);
} catch (Exception $e) {
}
$versionObj->appendChild(new DOMElement('documentation_link', $extensionRecord['external_manual'] ?: $documentationLink));
} }
} }
......
...@@ -615,4 +615,14 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -615,4 +615,14 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{ {
$this->notifications = $notifications; $this->notifications = $notifications;
} }
public function getMatrixOfSupportedTypo3Versions(): array
{
$supportedTypo3Versions = [];
foreach ($this->versions as $version) {
$version->getMatrixOfSupportedTypo3Versions($supportedTypo3Versions);
}
return $supportedTypo3Versions;
}
} }
...@@ -21,6 +21,8 @@ use TYPO3\CMS\Extbase\Persistence\ObjectStorage; ...@@ -21,6 +21,8 @@ use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
*/ */
class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{ {
const VERSION_IS_INSECURE = -1;
const VERSION_IS_OUTDATED = -2;
/** /**
* Title of the extension * Title of the extension
...@@ -1134,7 +1136,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -1134,7 +1136,7 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
} }
/** /**
* @return \T3o\TerFe2\Domain\Model\Relation * @return \T3o\TerFe2\Domain\Model\Relation|null
*/ */
public function getTypo3Dependency() public function getTypo3Dependency()
{ {
...@@ -1151,31 +1153,59 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity ...@@ -1151,31 +1153,59 @@ class Version extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
} }
/** /**
* @param array $supportedTypo3Versions
* @return array * @return array
*/ */
public function getMatrixOfSupportedTypo3Versions(): array public function getMatrixOfSupportedTypo3Versions(array $supportedTypo3Versions = []): array
{ {
// @todo: Get these versions automatically $ltsVersionService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\T3o\TerFe2\Service\LTSVersionService::class);
$typo3Versions = [ $oldLTSVersions = $ltsVersionService->getOldLTSVersions();
'7 LTS' => 7006000, $this->getSupportedTypo3Versions($supportedTypo3Versions, $oldLTSVersions, 'warning');
'8 LTS' => 8007000,
'9 LTS' => 9005000
];
$supportedTypo3Versions = [];
foreach ($typo3Versions as $label => $mainVersion) { $currentStableVersions = $ltsVersionService->getCurrentStableVersions(true);
$supportedTypo3Versions[$label] = \T3o\TerFe2\Utility\VersionUtility::doesExtensionSupportTypo3Version($this->getExtension(), $mainVersion); $this->getSupportedTypo3Versions($supportedTypo3Versions, $currentStableVersions, 'success');
if ($this->doesSupportTypo3Version($ltsVersionService->getLatestDevelopmentVersion(true))) {
$supportedTypo3Versions[$ltsVersionService->getVersionLabelOfRelease($ltsVersionService->getLatestDevelopmentVersion(true))] = [
'label' => $ltsVersionService->getVersionLabelOfRelease($ltsVersionService->getLatestDevelopmentVersion(true)) . '-dev',
'badgeClass' => 'info'
];
} }
return $supportedTypo3Versions; return $supportedTypo3Versions;
} }
/** public function doesSupportTypo3Version(int $versionNumber): bool
* @return bool
*/
public function hasTypo3Dependency()
{ {
return $this->getTypo3Dependency() !== null; if ($this->getTypo3Dependency() === null || $this->getReviewState() === \T3o\TerFe2\Domain\Model\Version::VERSION_IS_INSECURE) {
return false;
}
// reset from e.g. 7.6.21 to 7.6.0 for valid check
$resetMinimumVersion = (int)($this->getTypo3Dependency()->getMinimumVersion() / \T3o\TerFe2\Service\LTSVersionService::FACTOR_MINOR_VERSION) * \T3o\TerFe2\Service\LTSVersionService::FACTOR_MINOR_VERSION;
$supportsTypo3Version = $resetMinimumVersion <= $versionNumber && $this->getTypo3Dependency()->getMaximumVersion() >= $versionNumber;
if ($supportsTypo3Version) {
return true;
}
return false;
}
private function getSupportedTypo3Versions(array &$supportedTypo3Versions, array $versions, string $badgeClass)
{
$ltsVersionService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\T3o\TerFe2\Service\LTSVersionService::class);
foreach ($versions as $versionNumber) {
$mainVersion = floor($versionNumber / $ltsVersionService::FACTOR_MINOR_VERSION * $ltsVersionService::FACTOR_MINOR_VERSION);
$label = $ltsVersionService->getVersionLabelOfRelease($versionNumber) . ' LTS';
if ($this->doesSupportTypo3Version($mainVersion)) {
$supportedTypo3Versions[$ltsVersionService->getVersionLabelOfRelease($versionNumber)] = [
'label' => $label,
'badgeClass' => $badgeClass
];
}
}
} }
/** /**
......
...@@ -64,10 +64,14 @@ class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface ...@@ -64,10 +64,14 @@ class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface
$documentationLink = ''; $documentationLink = '';
$oldManualsInformation = json_decode(@file_get_contents(PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . 'oldmanuals.json'), true); $oldManualsInformation = json_decode(@file_get_contents(PATH_site . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . 'oldmanuals.json'), true);
if (isset($this->docsInformation[$extensionKey]['docs'][$versionString])) { foreach ($this->getPossibleVersionStrings($versionString) as $possibleVersionString) {
// link to extension to get the latest manual if (isset($this->docsInformation[$extensionKey]['docs'][$possibleVersionString])) {
$url = $this->docsInformation[$extensionKey]['docs'][$versionString]['url']; $url = $this->docsInformation[$extensionKey]['docs'][$possibleVersionString]['url'];
} elseif (isset($oldManualsInformation[$extensionKey])) { break;
}
}
if ($url === '' && isset($oldManualsInformation[$extensionKey])) {
$baseUrl = 'https://docs.typo3.org/typo3cms/extensions/'; $baseUrl = 'https://docs.typo3.org/typo3cms/extensions/';
$url = $baseUrl . $extensionKey . '/'; $url = $baseUrl . $extensionKey . '/';
} }
...@@ -78,4 +82,21 @@ class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface ...@@ -78,4 +82,21 @@ class DocumentationService implements \TYPO3\CMS\Core\SingletonInterface
return $returnUrlOnly ? $url : $documentationLink; return $returnUrlOnly ? $url : $documentationLink;
} }
private function getPossibleVersionStrings(string $defaultVersion): array
{
$possibleVersionStrings = [
$defaultVersion,
// just 2 points without v
];
$versionParts = explode('.', $defaultVersion);
if (count($versionParts) === 3) {
$possibleVersionStrings[] = implode('.', array_slice($versionParts, 0, 2));
}
$possibleVersionStrings[] = ltrim($defaultVersion, 'v');
$possibleVersionStrings[] = ltrim(implode('.', array_slice($versionParts, 0, 2)), 'v');
return $possibleVersionStrings;
}
} }
...@@ -21,11 +21,20 @@ use TYPO3\CMS\Core\Utility\VersionNumberUtility; ...@@ -21,11 +21,20 @@ use TYPO3\CMS\Core\Utility\VersionNumberUtility;
*/ */
class LTSVersionService class LTSVersionService
{ {
const FACTOR_MAIN_VERSION = 1000000;
const FACTOR_MINOR_VERSION = 1000;
const FIRST_LTS_VERSION_WITH_MAIN_VERSION_NUMBER = 7;
/** /**
* @var array * @var array
*/ */
public $coreData = ''; public $coreData = '';
public $ltsVersionsWithMinorVersions = [
'4.5',
'6.2'
];
public function __construct() public function __construct()
{ {
// Will be automatically update with UpdateCurrentVersionListTask see T3o\Ter\Task\UpdateCurrentVersionListTask // Will be automatically update with UpdateCurrentVersionListTask see T3o\Ter\Task\UpdateCurrentVersionListTask
...@@ -37,28 +46,72 @@ class LTSVersionService ...@@ -37,28 +46,72 @@ class LTSVersionService
/** /**
* Get the current stable versions * Get the current stable versions
* *
* @param bool $fullVersionNumber
* @return array * @return array
*/ */
public function getCurrentStableVersions() public function getCurrentStableVersions($fullVersionNumber = false): array
{ {
return [ return [
$this->getLatestOldLTS(), $this->getLatestOldLTS($fullVersionNumber),
$this->getLatestLTS() $this->getLatestLTS($fullVersionNumber)
]; ];
} }
/** /**
* Returns all maintained versions. * Returns all maintained versions.
* *
* @param bool $fullVersionNumber
* @return array * @return array
*/ */
public function getAllMaintainedVersions() public function getAllMaintainedVersions($fullVersionNumber = false): array
{ {
$versions = $this->getCurrentStableVersions(); $versions = $this->getCurrentStableVersions($fullVersionNumber);
array_push($versions, $this->getLatestDevelopmentVersion()); array_push($versions, $this->getLatestDevelopmentVersion($fullVersionNumber));
return $versions; return $versions;
} }
/**
* Get all LTS versions ever
*
* @return array
*/
public function getAllLTSVersions(): array
{
$ltsVersions = [];
foreach ($this->coreData as $releaseVersion => $releaseData) {
if (in_array($releaseVersion, $this->ltsVersionsWithMinorVersions) || $releaseVersion >= self::FIRST_LTS_VERSION_WITH_MAIN_VERSION_NUMBER) {
$latestVersionParts = explode('.', $releaseData['latest']);
if ((int)$latestVersionParts[1] === 0) {
continue;
}
$minimumVersion = $latestVersionParts[0] . '.' . $latestVersionParts[1] . '.0';
$ltsVersions[] = VersionNumberUtility::convertVersionNumberToInteger($minimumVersion);
}
}
sort($ltsVersions);
return $ltsVersions;
}
/**
* Get all LTS versions but current maintained
*
* @return array
*/
public function getOldLTSVersions(): array
{
$oldLTSVersions = $this->getAllLTSVersions();
foreach ($oldLTSVersions as $key => $version) {
$mainVersion = floor($version / self::FACTOR_MAIN_VERSION);
if (in_array($mainVersion, $this->getCurrentStableVersions())) {
unset($oldLTSVersions[$key]);
}
}
return $oldLTSVersions;
}
/** /**
* Get latest version within a specific release * Get latest version within a specific release
* *
...@@ -78,30 +131,57 @@ class LTSVersionService ...@@ -78,30 +131,57 @@ class LTSVersionService
/** /**
* Get latest development version * Get latest development version
* *
* @return string * @param bool $fullVersionNumber
* @return int
*/ */
public function getLatestDevelopmentVersion() public function getLatestDevelopmentVersion($fullVersionNumber = false): int
{ {
return substr($this->coreData['latest_stable'], 0, 3); if ($fullVersionNumber) {
return VersionNumberUtility::convertVersionNumberToInteger($this->coreData['latest_stable']);
}
return floor(VersionNumberUtility::convertVersionNumberToInteger($this->coreData['latest_stable']) / self::FACTOR_MAIN_VERSION);
}
public function getVersionLabelOfRelease(int $release): string
{
if ($release >= (self::FIRST_LTS_VERSION_WITH_MAIN_VERSION_NUMBER * self::FACTOR_MAIN_VERSION)) {
$versionLabel = (string)floor($release / self::FACTOR_MAIN_VERSION);
} else {
$fullVersionLabelParts = explode('.', VersionNumberUtility::convertIntegerToVersionNumber($release));
$versionLabel = $fullVersionLabelParts[0] . '.' . $fullVersionLabelParts[1];
}
return $versionLabel;
} }
/** /**
* Get latest LTS Version * Get latest LTS Version
* *
* @param bool $fullVersionNumber
* @return int * @return int
*/ */
private function getLatestLTS() public function getLatestLTS($fullVersionNumber = false): int
{ {
return (int)substr($this->coreData['latest_lts'], 0, 1); if ($fullVersionNumber) {
return VersionNumberUtility::convertVersionNumberToInteger($this->coreData['latest_lts']);
}
return floor(VersionNumberUtility::convertVersionNumberToInteger($this->coreData['latest_lts']) / self::FACTOR_MAIN_VERSION);
} }
/** /**
* Get latest "old" LTS Version * Get latest "old" LTS Version
* *
* @param bool $fullVersionNumber
* @return int * @return int
*/ */
private function getLatestOldLTS() public function getLatestOldLTS($fullVersionNumber = false): int
{ {
return (int)substr($this->coreData['latest_old_lts'], 0, 1); if ($fullVersionNumber) {
return VersionNumberUtility::convertVersionNumberToInteger($this->coreData['latest_old_lts']);
}
return floor(VersionNumberUtility::convertVersionNumberToInteger($this->coreData['latest_old_lts']) / self::FACTOR_MAIN_VERSION);
} }
} }
...@@ -109,24 +109,34 @@ class TerIndexer extends \ApacheSolrForTypo3\Solr\IndexQueue\Indexer ...@@ -109,24 +109,34 @@ class TerIndexer extends \ApacheSolrForTypo3\Solr\IndexQueue\Indexer
} }
// does this extension supports different versions? // does this extension supports different versions?
// @todo: use JSON with all versions to get them $supportMaintainedVersions = [];
$document->setField('supports7_boolS', false); $supportDevVersion = '';
$document->setField('supports8_boolS', false); $supportOlderVersions = [];
$document->setField('supports9_boolS', false);
$typo3Support = []; $ltsVersionService = GeneralUtility::makeInstance(\T3o\TerFe2\Service\LTSVersionService::class);
if (VersionUtility::doesExtensionSupportTypo3Version($extension, 7006000)) { foreach ($ltsVersionService->getCurrentStableVersions(true) as $versionNumber) {
$typo3Support[] = '7 LTS'; if (VersionUtility::doesExtensionSupportTypo3Version($extension, $versionNumber)) {