mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-21 02:39:10 -04:00
Finalisation de Google Drive
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user