From 29215763026b7a1f4fa33a6d2cdd9c3fade8bed2 Mon Sep 17 00:00:00 2001 From: Jeremy Huylebroeck <46967+mimizone@users.noreply.github.com> Date: Mon, 13 Nov 2023 14:28:28 -0800 Subject: [PATCH] System: Configuration: Backups - adds support for Google Shared drives and some minor cleanups. closes https://github.com/opnsense/core/issues/7008 --- src/opnsense/mvc/app/library/Google/API/Drive.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/opnsense/mvc/app/library/Google/API/Drive.php b/src/opnsense/mvc/app/library/Google/API/Drive.php index 0e29e22d8..0585f47c6 100644 --- a/src/opnsense/mvc/app/library/Google/API/Drive.php +++ b/src/opnsense/mvc/app/library/Google/API/Drive.php @@ -1,7 +1,7 @@ service->files->listFiles(array('q' => $query)); + return $this->service->files->listFiles(['q' => $query, 'supportsAllDrives' => true]); } @@ -108,7 +108,7 @@ class Drive */ public function download($fileHandle) { - $response = $this->service->files->get($fileHandle->id, array('alt' => 'media')); + $response = $this->service->files->get($fileHandle->id, ['alt' => 'media', 'supportsAllDrives' => true]); return $response->getBody()->getContents(); } @@ -127,13 +127,14 @@ class Drive $file->setName($filename); $file->setDescription($filename); $file->setMimeType('text/plain'); - $file->setParents(array($directoryId)); + $file->setParents([$directoryId]); - $createdFile = $this->service->files->create($file, array( + $createdFile = $this->service->files->create($file, [ 'data' => $content, 'mimeType' => $mimetype, 'uploadType' => 'media', - )); + 'supportsAllDrives' => true + ]); return $createdFile; } @@ -144,6 +145,6 @@ class Drive */ public function delete($fileHandle) { - $this->service->files->delete($fileHandle['id']); + $this->service->files->delete($fileHandle['id'], ['supportsAllDrives' => true]); } }