diff --git a/app/Models/Plugin.php b/app/Models/Plugin.php index 5125cc48b..5ac2b59f4 100644 --- a/app/Models/Plugin.php +++ b/app/Models/Plugin.php @@ -4,6 +4,7 @@ namespace App\Models; use App\Contracts\Plugins\HasPluginSettings; use App\Enums\PluginStatus; +use Exception; use Filament\Forms\Components\Component; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\File; @@ -197,13 +198,19 @@ class Plugin extends Model implements HasPluginSettings return false; } - /** @var array */ - $updateData = file_get_contents($this->update_url); - if ($updateData[$panelVersion]) { - return version_compare($updateData[$panelVersion]['version'], $this->version, '>'); - } + return cache()->remember("plugins.$this->id.update", now()->addHour(), function () use ($panelVersion) { + try { + /** @var array */ + $updateData = file_get_contents($this->update_url); + if ($updateData[$panelVersion]) { + return version_compare($updateData[$panelVersion]['version'], $this->version, '>'); + } + } catch (Exception $exception) { + report($exception); + } - return false; + return false; + }); } public function hasSettings(): bool