Improve update detection
This commit is contained in:
parent
e5b7dd203a
commit
5e69a6bc77
4 changed files with 3 additions and 4 deletions
|
@ -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());
|
||||
|
|
|
@ -12,8 +12,6 @@ namespace wishthis;
|
|||
|
||||
class Options
|
||||
{
|
||||
public bool $updateAvailable = false;
|
||||
|
||||
public string $version;
|
||||
|
||||
public function __construct(private Database $database)
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -88,6 +88,7 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
|
|||
|
||||
/** Update version */
|
||||
$options->setOption('version', $version);
|
||||
$options->setOption('updateAvailable', false);
|
||||
|
||||
header('Location: /?page=home');
|
||||
die();
|
||||
|
|
Loading…
Reference in a new issue