mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
update
This commit is contained in:
parent
8950a33bb4
commit
1bcf6cafab
2 changed files with 15 additions and 2 deletions
|
@ -79,7 +79,7 @@ class BackupResource extends Resource
|
|||
|
||||
Tables\Columns\TextColumn::make('size')
|
||||
->state(function (Backup $backup) {
|
||||
return $backup->size ? Number::fileSize($backup->size) : 'N/A';
|
||||
return $backup->size ? $backup->size : 'N/A';
|
||||
}),
|
||||
])
|
||||
->filters([
|
||||
|
|
|
@ -6,6 +6,7 @@ use App\Filament\Enums\BackupStatus;
|
|||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Support\Number;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class Backup extends Model
|
||||
|
@ -81,7 +82,7 @@ class Backup extends Model
|
|||
|
||||
$backupDoneFile = $this->path.'/backup.done';
|
||||
if (file_exists($backupDoneFile)) {
|
||||
$this->size = filesize($this->filepath);
|
||||
$this->size = Number::fileSize(filesize($this->filepath));
|
||||
$this->status = 'completed';
|
||||
$this->completed = true;
|
||||
$this->completed_at = now();
|
||||
|
@ -94,6 +95,18 @@ class Backup extends Model
|
|||
|
||||
$checkProcess = shell_exec('ps -p ' . $this->process_id . ' | grep ' . $this->process_id);
|
||||
if (Str::contains($checkProcess, $this->process_id)) {
|
||||
|
||||
// Check path size
|
||||
$pathSize = shell_exec('du -sh ' . $this->path);
|
||||
$pathSize = trim($pathSize);
|
||||
$pathSize = explode("\t", $pathSize);
|
||||
|
||||
if (isset($pathSize[0])) {
|
||||
$pathSize = $pathSize[0];
|
||||
$this->size = $pathSize;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
return [
|
||||
'status' => 'processing',
|
||||
'message' => 'Backup is still processing'
|
||||
|
|
Loading…
Reference in a new issue