Add visual button presets, jump targets and menu controls
This commit is contained in:
1 parent
bb4e422af8
commit
3391fea58b
41 files changed
+723
-57
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user