]> git.agnieray.net Git - galette.git/commitdiff
Prevent issue checking new release
authorJohan Cwiklinski <johan@x-tnd.be>
Sun, 24 Mar 2024 18:28:52 +0000 (19:28 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 24 Mar 2024 18:28:52 +0000 (19:28 +0100)
galette/lib/Galette/Features/Cacheable.php
galette/lib/Galette/Util/Release.php

index b0ba2e1d053a5425fb7315bf0cdac98ac5395bbc..4b9cbc6cc1a6407882c8071b9b072c96a3f60b00 100644 (file)
@@ -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);
index d332edb621d5b9d238361f0640886fc3c0f832c0..a43d4215ce24ccf9441288f5cf1b479fa3d5fe12 100644 (file)
@@ -39,6 +39,7 @@ class Release
     /** @var array<string, mixed> */
     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;
     }