mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 07:30:25 +00:00
update
This commit is contained in:
parent
70b51841eb
commit
4cc2fbb40d
4 changed files with 14 additions and 2 deletions
|
@ -111,6 +111,7 @@ class Backup extends Model
|
||||||
}
|
}
|
||||||
if (count($errorsBag) > 0) {
|
if (count($errorsBag) > 0) {
|
||||||
$this->status = 'failed';
|
$this->status = 'failed';
|
||||||
|
$this->backup_log = 'Backup failed. Database or env file missing.';
|
||||||
$this->save();
|
$this->save();
|
||||||
return [
|
return [
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
|
@ -126,6 +127,7 @@ class Backup extends Model
|
||||||
|
|
||||||
if (count($errorsBag) > 0) {
|
if (count($errorsBag) > 0) {
|
||||||
$this->status = 'failed';
|
$this->status = 'failed';
|
||||||
|
$this->backup_log = 'Backup failed. Database or env file content mismatch.';
|
||||||
$this->save();
|
$this->save();
|
||||||
return [
|
return [
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
|
@ -145,6 +147,7 @@ class Backup extends Model
|
||||||
$this->status = 'completed';
|
$this->status = 'completed';
|
||||||
$this->completed = true;
|
$this->completed = true;
|
||||||
$this->completed_at = now();
|
$this->completed_at = now();
|
||||||
|
$this->backup_log = 'Backup completed';
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -157,6 +160,7 @@ class Backup extends Model
|
||||||
if (Str::contains($checkProcess, $this->process_id)) {
|
if (Str::contains($checkProcess, $this->process_id)) {
|
||||||
|
|
||||||
$this->size = Helpers::checkPathSize($this->path);
|
$this->size = Helpers::checkPathSize($this->path);
|
||||||
|
$this->backup_log = 'Backup is still processing';
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -164,6 +168,7 @@ class Backup extends Model
|
||||||
'message' => 'Backup is still processing'
|
'message' => 'Backup is still processing'
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
|
$this->backup_log = 'Backup failed. Process not found';
|
||||||
$this->status = 'failed';
|
$this->status = 'failed';
|
||||||
$this->save();
|
$this->save();
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -16,6 +16,7 @@ return new class extends Migration
|
||||||
|
|
||||||
$table->string('backup_type')->nullable();
|
$table->string('backup_type')->nullable();
|
||||||
$table->string('status')->nullable();
|
$table->string('status')->nullable();
|
||||||
|
$table->string('backup_log')->nullable();
|
||||||
|
|
||||||
$table->string('path')->nullable();
|
$table->string('path')->nullable();
|
||||||
$table->string('root_path')->nullable();
|
$table->string('root_path')->nullable();
|
||||||
|
|
|
@ -17,6 +17,7 @@ return new class extends Migration
|
||||||
$table->bigInteger('hosting_subscription_id')->nullable();
|
$table->bigInteger('hosting_subscription_id')->nullable();
|
||||||
$table->string('backup_type')->nullable();
|
$table->string('backup_type')->nullable();
|
||||||
$table->string('status')->nullable();
|
$table->string('status')->nullable();
|
||||||
|
$table->string('backup_log')->nullable();
|
||||||
|
|
||||||
$table->string('path')->nullable();
|
$table->string('path')->nullable();
|
||||||
$table->string('root_path')->nullable();
|
$table->string('root_path')->nullable();
|
||||||
|
|
|
@ -30,7 +30,7 @@ class BackupTest extends ActionTestCase
|
||||||
|
|
||||||
|
|
||||||
$backupFinished = false;
|
$backupFinished = false;
|
||||||
for ($i = 0; $i < 400; $i++) {
|
for ($i = 0; $i < 100; $i++) {
|
||||||
|
|
||||||
Artisan::call('phyre:run-backup-checks');
|
Artisan::call('phyre:run-backup-checks');
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class BackupTest extends ActionTestCase
|
||||||
|
|
||||||
$findBackup = false;
|
$findBackup = false;
|
||||||
$backupCompleted = false;
|
$backupCompleted = false;
|
||||||
for ($i = 0; $i < 400; $i++) {
|
for ($i = 0; $i < 100; $i++) {
|
||||||
|
|
||||||
Artisan::call('phyre:run-backup-checks');
|
Artisan::call('phyre:run-backup-checks');
|
||||||
|
|
||||||
|
@ -98,6 +98,11 @@ class BackupTest extends ActionTestCase
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$backupCompleted) {
|
||||||
|
$findBackup = Backup::where('id', $backupId)->first();
|
||||||
|
$this->fail('Backup not completed: '.$findBackup->backup_log);
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertTrue($backupCompleted);
|
$this->assertTrue($backupCompleted);
|
||||||
$this->assertNotEmpty($findBackup->file_path);
|
$this->assertNotEmpty($findBackup->file_path);
|
||||||
$this->assertTrue(file_exists($findBackup->file_path));
|
$this->assertTrue(file_exists($findBackup->file_path));
|
||||||
|
|
Loading…
Reference in a new issue