Finalisation de Google Drive

This commit is contained in:
George Frederick "Buzz" Beurling
2020-03-10 16:26:48 -04:00
parent 8189bbce9a
commit 763e00435c
16 changed files with 798 additions and 751 deletions

View File

@@ -254,10 +254,21 @@ class GoogleDriveController extends Controller
public function checkFileSystem()
{
$error = [];
if(\App\Config::getData('is_Google_Drive_enabled'))
if(\App\Config::getData('is_Google_Drive_enabled') == "true")
{
$structure = $this->getFileStructure();
$this->checkStructure($structure,'/','/',$error);
if ($this->checkConfig())
{
$structure = $this->getFileStructure();
$this->checkStructure($structure,'/','/',$error);
}
else
{
$error = ['Il y a un probleme avec vos configurations'];
}
}
else
{
$error = ['Google Drive n\'est pas actif'];
}
return $error;
}
@@ -329,4 +340,24 @@ class GoogleDriveController extends Controller
return $dir;
}
public function checkConfig()
{
$configNull = (\Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_CLIENT_ID')) != "" && \Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_CLIENT_SECRET')) != "" && \Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_REFRESH_TOKEN')) != "" && \Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_FOLDER_ID')) != "");
$configOk = true;
if ($configNull)
{
try {
$contents = collect(Storage::cloud()->listContents("/", false));
}
catch (\Exception $e)
{
$configOk = false;
}
}
return $configNull && $configOk;
}
}