mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
update
This commit is contained in:
parent
cc820a7671
commit
f81cf44978
4 changed files with 76 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Jobs\ProcessHostingSubscriptionBackup;
|
||||
use App\Models\Backup;
|
||||
use App\Models\HostingSubscription;
|
||||
use App\Models\HostingSubscriptionBackup;
|
||||
|
@ -45,10 +46,8 @@ class CreateDailyFullHostingSubscriptionsBackup extends Command
|
|||
->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();
|
||||
|
||||
ProcessHostingSubscriptionBackup::dispatch($hostingSubscription->id);
|
||||
|
||||
} else {
|
||||
$this->error('Backup already exists for ' . $hostingSubscription->domain);
|
||||
|
|
40
web/app/Jobs/ProcessHostingSubscriptionBackup.php
Normal file
40
web/app/Jobs/ProcessHostingSubscriptionBackup.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\HostingSubscriptionBackup;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ProcessHostingSubscriptionBackup implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $hostingSubscriptionId;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct($hostingSubscriptionId)
|
||||
{
|
||||
$this->hostingSubscriptionId = $hostingSubscriptionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
echo "Backing up hosting subscription with ID: {$this->hostingSubscriptionId}\n";
|
||||
|
||||
sleep(3);
|
||||
//
|
||||
// $backup = new HostingSubscriptionBackup();
|
||||
// $backup->hosting_subscription_id = $this->hostingSubscriptionId;
|
||||
// $backup->backup_type = 'full';
|
||||
// $backup->save();
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||
'default' => 'database',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue