diff --git a/index.php b/index.php index c8fc371e..ddf3c4db 100644 --- a/index.php +++ b/index.php @@ -95,7 +95,7 @@ if ($options && !isset($_POST['install'])) { $version = str_replace('v', '', $tag); if (-1 === version_compare($options->version, $version)) { - $options->updateAvailable = true; + $options->setOption('updateAvailable', true); } } catch (\Github\Exception\RuntimeException $th) { echo wishthis\Page::warning($th->getMessage()); diff --git a/src/classes/options.php b/src/classes/options.php index 27b5cf9d..b8883f56 100644 --- a/src/classes/options.php +++ b/src/classes/options.php @@ -12,8 +12,6 @@ namespace wishthis; class Options { - public bool $updateAvailable = false; - public string $version; public function __construct(private Database $database) diff --git a/src/classes/page.php b/src/classes/page.php index 554bee74..d156e52b 100644 --- a/src/classes/page.php +++ b/src/classes/page.php @@ -321,7 +321,7 @@ class Page global $options; - if ($options->updateAvailable && $user && 100 === $user->power) { + if ($options->getOption('updateAvailable') && $user && 100 === $user->power) { $pages['system']['items'][] = array( 'url' => '/?page=update', 'text' => 'Update', diff --git a/src/pages/update.php b/src/pages/update.php index 0ece2778..60e763b5 100644 --- a/src/pages/update.php +++ b/src/pages/update.php @@ -88,6 +88,7 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) { /** Update version */ $options->setOption('version', $version); + $options->setOption('updateAvailable', false); header('Location: /?page=home'); die();