mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 07:30:25 +00:00
update
This commit is contained in:
parent
4e19730e02
commit
bb75a16428
4 changed files with 38 additions and 26 deletions
|
@ -42,7 +42,7 @@ class RunBackup extends Command
|
|||
|
||||
if ($getPendingBackups->count() > 0) {
|
||||
if ($getPendingBackups->count() > 1) {
|
||||
$this->info('Multiple backups are pending..');
|
||||
$this->info('Multiple backups are pending...');
|
||||
} else {
|
||||
foreach ($getPendingBackups as $pendingBackup) {
|
||||
$pendingBackup->startBackup();
|
||||
|
|
|
@ -17,7 +17,7 @@ class RunHostingSubscriptionsBackup extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'phyre:run-hosting-subscriptions-backup';
|
||||
protected $signature = 'phyre:run-hosting-subscriptions-backup-checks';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -37,26 +37,26 @@ class RunHostingSubscriptionsBackup extends Command
|
|||
$backup->delete();
|
||||
}
|
||||
|
||||
// Find Hosting Subscriptions
|
||||
$findHostingSubscriptions = HostingSubscription::all();
|
||||
if ($findHostingSubscriptions->count() > 0) {
|
||||
foreach ($findHostingSubscriptions as $hostingSubscription) {
|
||||
|
||||
$findBackup = HostingSubscriptionBackup::where('hosting_subscription_id', $hostingSubscription->id)
|
||||
->where('backup_type', 'full')
|
||||
->where('created_at', '>=', Carbon::now()->subHours(24))
|
||||
->first();
|
||||
if (! $findBackup) {
|
||||
$backup = new HostingSubscriptionBackup();
|
||||
$backup->hosting_subscription_id = $hostingSubscription->id;
|
||||
$backup->backup_type = 'full';
|
||||
$backup->save();
|
||||
} else {
|
||||
$this->error('Backup already exists for ' . $hostingSubscription->domain);
|
||||
$this->error('Created before: ' . $findBackup->created_at->diffForHumans());
|
||||
}
|
||||
}
|
||||
}
|
||||
// // Find Hosting Subscriptions
|
||||
// $findHostingSubscriptions = HostingSubscription::all();
|
||||
// if ($findHostingSubscriptions->count() > 0) {
|
||||
// foreach ($findHostingSubscriptions as $hostingSubscription) {
|
||||
//
|
||||
// $findBackup = HostingSubscriptionBackup::where('hosting_subscription_id', $hostingSubscription->id)
|
||||
// ->where('backup_type', 'full')
|
||||
// ->where('created_at', '>=', Carbon::now()->subHours(24))
|
||||
// ->first();
|
||||
// if (! $findBackup) {
|
||||
// $backup = new HostingSubscriptionBackup();
|
||||
// $backup->hosting_subscription_id = $hostingSubscription->id;
|
||||
// $backup->backup_type = 'full';
|
||||
// $backup->save();
|
||||
// } else {
|
||||
// $this->error('Backup already exists for ' . $hostingSubscription->domain);
|
||||
// $this->error('Created before: ' . $findBackup->created_at->diffForHumans());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// Check for pending backups
|
||||
|
@ -64,8 +64,8 @@ class RunHostingSubscriptionsBackup extends Command
|
|||
->get();
|
||||
|
||||
if ($getPendingBackups->count() > 0) {
|
||||
if ($getPendingBackups->count() > 3) {
|
||||
$this->info('There are more than 3 pending backups. Please wait for them to finish.');
|
||||
if ($getPendingBackups->count() > 1) {
|
||||
$this->info('Multiple backups are pending...');
|
||||
} else {
|
||||
foreach ($getPendingBackups as $pendingBackup) {
|
||||
$pendingBackup->startBackup();
|
||||
|
|
|
@ -7,6 +7,7 @@ use App\Filament\Resources\HostingPlanResource\Pages;
|
|||
use App\Models\HostingPlan;
|
||||
use App\Models\RemoteDatabaseServer;
|
||||
use App\SupportedApplicationTypes;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\Select;
|
||||
|
@ -250,6 +251,7 @@ class HostingPlanResource extends Resource
|
|||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make()
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
|
|
|
@ -65,7 +65,7 @@ class HostingSubscriptionBackup extends Model
|
|||
|
||||
public function checkCronJob()
|
||||
{
|
||||
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:run-hosting-subscriptions-backup';
|
||||
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:run-hosting-subscriptions-backup-checks';
|
||||
$findCronJob = CronJob::where('command', $cronJobCommand)->first();
|
||||
if (! $findCronJob) {
|
||||
$cronJob = new CronJob();
|
||||
|
@ -73,8 +73,18 @@ class HostingSubscriptionBackup extends Model
|
|||
$cronJob->command = $cronJobCommand;
|
||||
$cronJob->user = 'root';
|
||||
$cronJob->save();
|
||||
return false;
|
||||
}
|
||||
|
||||
$cronJobCommand = 'phyre-php /usr/local/phyre/web/artisan phyre:create-daily-full-hosting-subscriptions-backup';
|
||||
$findCronJob = CronJob::where('command', $cronJobCommand)->first();
|
||||
if (! $findCronJob) {
|
||||
$cronJob = new CronJob();
|
||||
$cronJob->schedule = '0 0 * * *';
|
||||
$cronJob->command = $cronJobCommand;
|
||||
$cronJob->user = 'root';
|
||||
$cronJob->save();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue