This commit is contained in:
Jay Trees 2022-01-17 13:22:47 +01:00
parent b4cc63387b
commit 195d5e4609
2 changed files with 6 additions and 3 deletions

View file

@ -14,8 +14,13 @@ class Options
{ {
public bool $updateAvailable = false; public bool $updateAvailable = false;
public string $version;
public function __construct(private Database $database) public function __construct(private Database $database)
{ {
$this->version = $this->getOption('version')
? $this->getOption('version')
: '0.1.0';
} }
public function getOption(string $key): string public function getOption(string $key): string

View file

@ -73,9 +73,7 @@ if (!$options) {
* Update * Update
*/ */
if ($options) { if ($options) {
$version_current = $options->getOption('version') ?? '0.0.0'; if (-1 === version_compare($options->version, $version_new)) {
if (-1 === version_compare($version_current, $version_new)) {
$options->updateAvailable = true; $options->updateAvailable = true;
} }
} }