Refactor + package updates + improve local backups

This commit is contained in:
Andras Bacsai
2023-08-10 15:52:54 +02:00
parent d2a4dbf283
commit e17f1935d2
30 changed files with 757 additions and 366 deletions

View File

@@ -1,5 +1,6 @@
<?php
use App\Models\Server;
use App\Models\StandaloneDocker;
use App\Models\StandalonePostgresql;
use Visus\Cuid2\Cuid2;
@@ -24,5 +25,18 @@ function create_standalone_postgresql($environment_id, $destination_uuid): Stand
'destination_id' => $destination->id,
'destination_type' => $destination->getMorphClass(),
]);
}
/**
* Delete file locally on the filesystem.
* @param string $filename
* @param Server $server
* @return void
*/
function delete_backup_locally(string|null $filename, Server $server): void
{
if (empty($filename)) {
return;
}
instant_remote_process(["rm -f \"{$filename}\""], $server, throwError: false);
}