Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Render correct version information in Core Updater and repor…
…ts module Currently, the TYPO3 backend shows incomplete version information regarding updates in the Core Updater and the reports. Both take community-supported releases into account only and ignore the fact that certain versions are covered by the ELTS program and thus render messages about unsupported or invalid versions, which are false statements. We now use the full information from get.typo3.org, and added lengthy tests to avoid any further issues. The internally used CoreVersionService is now able to handle ELTS releases as well and give proper information to admins. Resolves: #94745 Releases: master, 10.4, 9.5 Change-Id: I6485d36ded943acba723d55e23275554484e4f82 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70311 Tested-by: core-ci <typo3@b13.com> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
- Loading branch information
1 parent
a02928f
commit 4d4c37b
Showing
10 changed files
with
900 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Install\CoreVersion; | ||
|
||
class CoreRelease | ||
{ | ||
protected const RELEASE_TYPE_REGULAR = 'regular'; | ||
protected const RELEASE_TYPE_SECURITY = 'security'; | ||
|
||
protected $version; | ||
protected $date; | ||
protected $type; | ||
protected $checksum; | ||
protected $isElts; | ||
|
||
public function __construct(string $version, \DateTimeInterface $date, string $type, string $checksum, bool $isElts = false) | ||
{ | ||
$this->version = $version; | ||
$this->date = $date; | ||
$this->type = $type; | ||
$this->checksum = $checksum; | ||
$this->isElts = $isElts; | ||
} | ||
|
||
public static function fromApiResponse(array $response): self | ||
{ | ||
return new self($response['version'], new \DateTimeImmutable($response['date']), $response['type'], $response['tar_package']['sha1sum'], $response['elts'] ?? false); | ||
} | ||
|
||
public function getVersion(): string | ||
{ | ||
return $this->version; | ||
} | ||
|
||
public function getDate(): \DateTimeInterface | ||
{ | ||
return $this->date; | ||
} | ||
|
||
public function isSecurityUpdate(): bool | ||
{ | ||
return $this->type === self::RELEASE_TYPE_SECURITY; | ||
} | ||
|
||
public function getChecksum(): string | ||
{ | ||
return $this->checksum; | ||
} | ||
|
||
public function isElts(): bool | ||
{ | ||
return $this->isElts; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
typo3/sysext/install/Classes/CoreVersion/MaintenanceWindow.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Install\CoreVersion; | ||
|
||
class MaintenanceWindow | ||
{ | ||
protected $communitySupport; | ||
protected $eltsSupport; | ||
|
||
public function __construct(?\DateTimeInterface $communitySupport, ?\DateTimeInterface $eltsSupport) | ||
{ | ||
$this->communitySupport = $communitySupport; | ||
$this->eltsSupport = $eltsSupport; | ||
} | ||
|
||
public static function fromApiResponse(array $response): self | ||
{ | ||
$maintainedUntil = isset($response['maintained_until']) ? new \DateTimeImmutable($response['maintained_until']) : null; | ||
$eltsUntil = isset($response['elts_until']) ? new \DateTimeImmutable($response['elts_until']) : null; | ||
|
||
return new self($maintainedUntil, $eltsUntil); | ||
} | ||
|
||
public function isSupportedByCommunity(): bool | ||
{ | ||
return $this->isSupported($this->communitySupport); | ||
} | ||
|
||
public function isSupportedByElts(): bool | ||
{ | ||
return $this->isSupported($this->eltsSupport); | ||
} | ||
|
||
protected function isSupported(?\DateTimeInterface $supportedUntil): bool | ||
{ | ||
return $supportedUntil !== null | ||
&& ( | ||
$supportedUntil >= | ||
new \DateTimeImmutable('now', new \DateTimeZone('UTC')) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Install\CoreVersion; | ||
|
||
class MajorRelease | ||
{ | ||
protected $version; | ||
protected $lts; | ||
protected $title; | ||
protected $maintenanceWindow; | ||
|
||
public function __construct(string $version, ?string $lts, string $title, MaintenanceWindow $maintenanceWindow) | ||
{ | ||
$this->version = $version; | ||
$this->lts = $lts; | ||
$this->title = $title; | ||
$this->maintenanceWindow = $maintenanceWindow; | ||
} | ||
|
||
public static function fromApiResponse(array $response): self | ||
{ | ||
$maintenanceWindow = MaintenanceWindow::fromApiResponse($response); | ||
$ltsVersion = isset($response['lts']) ? (string)$response['lts'] : null; | ||
|
||
return new self((string)$response['version'], $ltsVersion, $response['title'], $maintenanceWindow); | ||
} | ||
|
||
public function getVersion(): string | ||
{ | ||
return $this->version; | ||
} | ||
|
||
public function getLts(): ?string | ||
{ | ||
return $this->lts; | ||
} | ||
|
||
public function getTitle(): string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function getMaintenanceWindow(): MaintenanceWindow | ||
{ | ||
return $this->maintenanceWindow; | ||
} | ||
} |
Oops, something went wrong.