mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 07:30:25 +00:00
update
This commit is contained in:
parent
e68b198d74
commit
71ba6c2946
2 changed files with 14 additions and 7 deletions
|
@ -3,6 +3,7 @@
|
|||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Backup;
|
||||
use App\Models\HostingSubscriptionBackup;
|
||||
use App\Models\RemoteBackupServer;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
|
@ -41,12 +42,21 @@ class RunUploadBackupsToRemoteServers extends Command
|
|||
$findBackups = Backup::where('status', 'completed')->get();
|
||||
if ($findBackups->count() > 0) {
|
||||
foreach ($findBackups as $backup) {
|
||||
$uploadStatus = $remoteBackupServer->uploadFile($backup->filepath);
|
||||
$uploadStatus = $remoteBackupServer->uploadFile($backup->filepath, 'phyre-system-backups');
|
||||
}
|
||||
} else {
|
||||
$this->info('No backups found to upload.');
|
||||
}
|
||||
|
||||
$findHostingSubscriptionBackups = HostingSubscriptionBackup::where('status', 'completed')->get();
|
||||
if ($findHostingSubscriptionBackups->count() > 0) {
|
||||
foreach ($findHostingSubscriptionBackups as $hostingSubscriptionBackup) {
|
||||
$uploadStatus = $remoteBackupServer->uploadFile($hostingSubscriptionBackup->filepath, 'phyre-hosting-subscription-backups');
|
||||
}
|
||||
} else {
|
||||
$this->info('No hosting subscription backups found to upload.');
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$this->info('No remote backup servers found.');
|
||||
|
|
|
@ -73,7 +73,7 @@ class RemoteBackupServer extends Model
|
|||
|
||||
}
|
||||
|
||||
public function uploadFile($filepath)
|
||||
public function uploadFile($filepath, $directory)
|
||||
{
|
||||
$username = trim($this->username);
|
||||
$password = trim($this->password);
|
||||
|
@ -82,12 +82,9 @@ class RemoteBackupServer extends Model
|
|||
|
||||
if ($this->type == 'ftp') {
|
||||
|
||||
$path = trim($this->path);
|
||||
if ($path == '/') {
|
||||
$path = '';
|
||||
}
|
||||
$directory = trim($directory);
|
||||
|
||||
$uploadCurlCommand = "curl -T $filepath ftp://$username:$password@$hostname:$port "." $path";
|
||||
$uploadCurlCommand = "curl -T $filepath ftp://$hostname:$port/$directory/ -u '$username:$password' --ftp-create-dirs";
|
||||
$uploadCurlCommand = trim($uploadCurlCommand);
|
||||
|
||||
$uploadCurlProcess = Process::fromShellCommandline($uploadCurlCommand);
|
||||
|
|
Loading…
Reference in a new issue