From: Johan Cwiklinski Date: Sun, 24 Mar 2024 18:28:52 +0000 (+0100) Subject: Prevent issue checking new release X-Git-Url: https://git.agnieray.net/?a=commitdiff_plain;h=31205b609dc142bede0a804ae534554354f218b5;p=galette.git Prevent issue checking new release --- diff --git a/galette/lib/Galette/Features/Cacheable.php b/galette/lib/Galette/Features/Cacheable.php index b0ba2e1d0..4b9cbc6cc 100644 --- a/galette/lib/Galette/Features/Cacheable.php +++ b/galette/lib/Galette/Features/Cacheable.php @@ -35,6 +35,7 @@ trait Cacheable { //number of hours until cache will be invalid protected int $cache_timeout = 24; + protected bool $nocache = false; /** * Handle cache @@ -45,6 +46,7 @@ trait Cacheable */ protected function handleCache(bool $nocache = false): void { + $this->nocache = $nocache; if ($nocache === false && !Galette::isDebugEnabled()) { if (!$this->checkCache()) { $this->makeCache(); @@ -112,6 +114,10 @@ trait Cacheable */ protected function makeCache(): void { + if ($this->nocache === true) { + //for some reason, we do not want to use cache + return; + } $this->prepareForCache(); $cfile = $this->getCacheFilename(); $cdir = dirname($cfile); diff --git a/galette/lib/Galette/Util/Release.php b/galette/lib/Galette/Util/Release.php index d332edb62..a43d4215c 100644 --- a/galette/lib/Galette/Util/Release.php +++ b/galette/lib/Galette/Util/Release.php @@ -39,6 +39,7 @@ class Release /** @var array */ private array $default_options = [ 'timeout' => 2.0, + 'verify' => false ]; private ?string $latest = null; @@ -84,6 +85,10 @@ class Release if (!isset($this->latest)) { $this->latest = $this->findLatestRelease(); } + if ($this->latest === null) { + //disable caching, no version has been found + $this->nocache = true; + } return $this->latest; }