diff --git a/includes/classes/options.php b/includes/classes/options.php index 50fe634b..e1130aa4 100644 --- a/includes/classes/options.php +++ b/includes/classes/options.php @@ -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; + } + } } diff --git a/includes/pages/update.php b/includes/pages/update.php index 862e8e34..dcff9189 100644 --- a/includes/pages/update.php +++ b/includes/pages/update.php @@ -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(); } ?>