Eine kleine, von außen sichtbare Änderung - sie ist der Prüfstein für das Update: nach dem Einspielen muss in der Seitenleiste 1.0.1 stehen, und der Weg dorthin muss die Schritte gegangen sein, die der Updater verspricht. Die Fassung kommt über eine Twig-Funktion in die Vorlage, nicht über einen globalen Dienst: die Vorlagen bekommen genau diese eine lesende Antwort und nicht einen Updater mit update() darauf. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
26 lines
590 B
PHP
26 lines
590 B
PHP
<?php
|
|
|
|
namespace App\Twig;
|
|
|
|
use App\Ops\Updater;
|
|
use Twig\Extension\AbstractExtension;
|
|
use Twig\TwigFunction;
|
|
|
|
/**
|
|
* The running version, for the administration shell.
|
|
*
|
|
* A function rather than a global, so the templates get exactly this one read-only answer and not
|
|
* a whole updater with an update() method on it.
|
|
*/
|
|
final class VersionExtension extends AbstractExtension
|
|
{
|
|
public function __construct(private Updater $updater)
|
|
{
|
|
}
|
|
|
|
public function getFunctions(): array
|
|
{
|
|
return [new TwigFunction('kant_version', $this->updater->version(...))];
|
|
}
|
|
}
|