Fix updater to v0.2.0

This commit is contained in:
Jay Trees 2022-01-18 11:49:37 +01:00
parent 382b898009
commit 329b7abce4
2 changed files with 22 additions and 0 deletions

View file

@ -40,4 +40,18 @@ class Options
return $value;
}
public function setOption(string $key, string $value): void
{
try {
$option = $this->database->query('UPDATE `options`
SET `value`
WHERE `key` = ' . $key . '
;');
$value = $option['value'] ?? '';
} catch (\Throwable $th) {
//throw $th;
}
}
}

View file

@ -28,7 +28,15 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
$database->query('ALTER TABLE `wishlists`
ADD `url` VARCHAR(128) NOT NULL AFTER `name`
;');
$database->query('INSERT INTO `options` (`key`, `value`) VALUES ("version", "' . VERSION . '");');
// Use this for future versions since it didn't existsin 0.1.0
// $options->setOption('version', VERSION);
}
header('Location: /?page=home');
die();
}
?>