Fix version updater
This commit is contained in:
parent
1c5f86b830
commit
516c1a8374
3 changed files with 7 additions and 14 deletions
|
@ -43,15 +43,9 @@ class Options
|
||||||
|
|
||||||
public function setOption(string $key, string $value): void
|
public function setOption(string $key, string $value): void
|
||||||
{
|
{
|
||||||
try {
|
$this->database->query('UPDATE `options`
|
||||||
$option = $this->database->query('UPDATE `options`
|
SET `value` = "' . $value . '"
|
||||||
SET `value`
|
WHERE `key` = "' . $key . '"
|
||||||
WHERE `key` = ' . $key . '
|
|
||||||
;');
|
;');
|
||||||
|
|
||||||
$value = $option['value'] ?? '';
|
|
||||||
} catch (\Throwable $th) {
|
|
||||||
//throw $th;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,10 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
|
||||||
$database->query('ALTER TABLE `wishlists` ADD INDEX(`hash`);');
|
$database->query('ALTER TABLE `wishlists` ADD INDEX(`hash`);');
|
||||||
|
|
||||||
$database->query('INSERT INTO `options` (`key`, `value`) VALUES ("version", "' . VERSION . '");');
|
$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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$options->setOption('version', VERSION);
|
||||||
|
|
||||||
header('Location: /?page=home');
|
header('Location: /?page=home');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ if ($options) {
|
||||||
/**
|
/**
|
||||||
* Update
|
* Update
|
||||||
*/
|
*/
|
||||||
define('VERSION', '0.2.0');
|
define('VERSION', '0.2.1');
|
||||||
|
|
||||||
if ($options) {
|
if ($options) {
|
||||||
if (-1 === version_compare($options->version, VERSION)) {
|
if (-1 === version_compare($options->version, VERSION)) {
|
||||||
|
|
Loading…
Reference in a new issue