Add visual button presets, jump targets and menu controls
CMS quality / php (8.2) (push) Canceled after 0s
CMS quality / php (8.4) (push) Canceled after 0s
CMS quality / browser (push) Canceled after 0s
CMS quality / mysql (push) Canceled after 0s

This commit is contained in:
kantarci committed 2026-09-14 13:47:49 +02:00
1 parent bb4e422af8
commit 3391fea58b
41 files changed
+723 -57

No files matched your search

+18 -2
View File
@@ -14,12 +14,28 @@ use Twig\TwigFunction;
*/
final class VersionExtension extends AbstractExtension
{
public function __construct(private Updater $updater)
public function __construct(private Updater $updater, private \Doctrine\DBAL\Connection $db)
{
}
public function getFunctions(): array
{
return [new TwigFunction('kant_version', $this->updater->version(...))];
return [new TwigFunction('kant_version', $this->updater->version(...)), new TwigFunction('kant_update_version', $this->available(...))];
}
public function available(): ?string
{
// The daily worker already checks releases. Rendering navigation never contacts Git.
try {
$message = $this->db->fetchOne('SELECT last_message FROM scheduled_task WHERE name = ?', ['update-check']);
if (is_string($message) && 1 === preg_match('/^Fassung (\d+\.\d+\.\d+) ist verfügbar/', $message, $match)
&& version_compare($match[1], $this->updater->version(), '>')) {
return $match[1];
}
} catch (\Doctrine\DBAL\Exception) {
// An installation still waiting for migrations has no task table yet.
}
return null;
}
}