mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
update
This commit is contained in:
parent
02bfdbb1ee
commit
72e7229539
2 changed files with 37 additions and 15 deletions
37
web/app/Console/Commands/CreateDailyFullBackup.php
Normal file
37
web/app/Console/Commands/CreateDailyFullBackup.php
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace app\Console\Commands;
|
||||
|
||||
use App\Models\Backup;
|
||||
use App\Models\HostingSubscription;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateDailyFullBackup extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'phyre:create-daily-full-backup';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$backup = new Backup();
|
||||
$backup->backup_type = 'full';
|
||||
$backup->save();
|
||||
}
|
||||
}
|
|
@ -36,21 +36,6 @@ class RunBackup extends Command
|
|||
$backup->delete();
|
||||
}
|
||||
|
||||
$findBackupsToday = Backup::where('created_at', '>=', Carbon::now()->subHours(24))
|
||||
->where(function ($query) {
|
||||
$query->where('status', 'completed')
|
||||
->orWhere('status', 'processing');
|
||||
})
|
||||
->first();
|
||||
|
||||
if (! $findBackupsToday) {
|
||||
$backup = new Backup();
|
||||
$backup->backup_type = 'full';
|
||||
$backup->save();
|
||||
} else {
|
||||
$this->info('We already have a backup for today.');
|
||||
}
|
||||
|
||||
// Check for pending backups
|
||||
$getPendingBackups = Backup::where('status', 'pending')
|
||||
->get();
|
||||
|
|
Loading…
Reference in a new issue