diff --git a/app/Console/Commands/VersionChecker.php b/app/Console/Commands/VersionChecker.php deleted file mode 100644 index 6737e8c43..000000000 --- a/app/Console/Commands/VersionChecker.php +++ /dev/null @@ -1,56 +0,0 @@ -isOutOfDate()) { - return; - } - - $admins = User::where('role', '=', UserRole::Admin)->get(); - - foreach ($admins as $user) { - Notification::make() - ->title('Update Available') - ->body("There's a new version of Speedtest Tracker available: {$system->getRemoteVersion()}") - ->info() - ->actions([ - Action::make('view releases') - ->button() - ->color('gray') - ->url('https://github.com/alexjustesen/speedtest-tracker/releases') - ->openUrlInNewTab(), - ]) - ->sendToDatabase($user); - } - } -} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 2d875fd02..b692530a0 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,7 +2,6 @@ namespace App\Providers; -use App\Services\SystemChecker; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Console\AboutCommand; use Illuminate\Http\Request; @@ -45,11 +44,8 @@ public function boot(): void URL::forceScheme('https'); } - $system = new SystemChecker; - AboutCommand::add('Speedtest Tracker', fn () => [ - 'Version' => $system->getLocalVersion(), - 'Out of date' => $system->isOutOfDate() ? 'Yes' : 'No', + 'Version' => config('speedtest.build_version'), ]); } diff --git a/app/Services/SystemChecker.php b/app/Services/SystemChecker.php deleted file mode 100644 index 8d7ee391f..000000000 --- a/app/Services/SystemChecker.php +++ /dev/null @@ -1,61 +0,0 @@ -localVersion = trim($this->getLocalVersion()); - - $this->remoteVersion = trim($this->getRemoteVersion()); - - return $this; - } - - public function getLocalVersion() - { - return config('speedtest.build_version'); - } - - public function getRemoteVersion() - { - return cache()->remember($this->cacheKeyRemote, now()->addDay(), function () { - return shell_exec('curl https://api.github.com/repos/alexjustesen/speedtest-tracker/releases/latest -s | grep \'"tag_name":\' | sed -E \'s/.*"([^"]+)".*/\1/\''); - }); - } - - public function isOutOfDate() - { - $this->getVersions(); - - return $this->localVersion != $this->remoteVersion; - } - - public function flushVersionData() - { - try { - cache()->forget($this->cacheKeyLocal); - - cache()->forget($this->cacheKeyRemote); - } catch (\Exception $exception) { - // fail silently, it's ok - } - } - - public function getPhpVersion(): string - { - return phpversion(); - } -} diff --git a/routes/console.php b/routes/console.php index 16aca67af..e4a670f0b 100644 --- a/routes/console.php +++ b/routes/console.php @@ -12,13 +12,6 @@ return config('speedtest.prune_results_older_than') > 0; }); -/** - * Checked for new versions weekly on Thursday because - * I usually do releases on Thursday or Friday. - */ -Schedule::command('app:version') - ->weeklyOn(5); - /** * Nightly maintenance */