error('Backup disk not configured.'); $this->error('See https://docs.pixelfed.org/technical-documentation/env.html#filesystem for more information.'); return Command::FAILURE; } $newest = $backupDestination->newestBackup(); if (! $newest instanceof Backup) { $this->error('No backup found to upload.'); return Command::FAILURE; } $name = $newest->path(); $parts = explode('/', $name); $fileName = array_pop($parts); $storagePath = 'backups'; $path = storage_path('app/'.$name); $file = $cloudDisk->putFileAs($storagePath, new File($path), $fileName, 'private'); if ($file === false) { $this->error('Failed to upload the backup to cloud storage.'); return Command::FAILURE; } $this->info('Backup file successfully saved!'); $url = $cloudDisk->url($file); $this->table( ['Name', 'URL'], [ [$fileName, $url], ], ); return Command::SUCCESS; } }