Update Notification on Overview
This commit is contained in:
parent
540bb95291
commit
bfa24facf9
43
app/Console/Commands/GetGithubVersion.php
Normal file
43
app/Console/Commands/GetGithubVersion.php
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class GetGithubVersion extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'cp:versioncheck:get';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Get the latest Version from Github';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
$latestVersion = Http::get('https://api.github.com/repos/controlpanel-gg/dashboard/tags')->json()[0]['name'];
|
||||||
|
Storage::disk('local')->put('latestVersion', $latestVersion);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
Storage::disk('local')->put('latestVersion', "unknown");
|
||||||
|
Log::error($e);
|
||||||
|
}
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
$schedule->command('credits:charge')->hourly();
|
$schedule->command('credits:charge')->hourly();
|
||||||
|
$schedule->command('cp:versioncheck:get')->daily();
|
||||||
|
|
||||||
//log cronjob activity
|
//log cronjob activity
|
||||||
$schedule->call(function () {
|
$schedule->call(function () {
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<h1>{{__('Admin Overview')}}</h1>
|
<h1>{{__('Admin Overview')}}</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<ol class="breadcrumb float-sm-right">
|
<ol class="breadcrumb float-sm-right">
|
||||||
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
|
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
|
||||||
|
@ -17,6 +18,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@if(Storage::get('latestVersion') && config("app.version") < Storage::get('latestVersion'))
|
||||||
|
<div class="alert alert-danger" role="alert">
|
||||||
|
<b><i class="fas fa-shield-alt"></i> {{__("Version Outdated:")}}</b></br>
|
||||||
|
{{__("You are running on")}} v{{config("app.version")}}-{{config("BRANCHNAME")}}.
|
||||||
|
{{__("The latest Version is")}} v{{Storage::get('latestVersion')}}</br>
|
||||||
|
<a href="https://controlpanel.gg/docs/Installation/updating">{{__("Consider updating now")}}</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</section>
|
</section>
|
||||||
<!-- END CONTENT HEADER -->
|
<!-- END CONTENT HEADER -->
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue