From 6141b24d9629ce181a86bbc7b6bb1d2c13c28154 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 23 Apr 2013 12:36:30 +0200 Subject: [PATCH] External Storage: Check for curl in PHP If no curl is found, disable the storage that needs it. --- apps/files_external/lib/config.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 01462cb6f85..4cb9b7c8ecd 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -70,7 +70,7 @@ class OC_Mount_Config { 'root' => '&Root', 'secure' => '!Secure ftps://')); - $backends['\OC\Files\Storage\Google']=array( + if(OC_Mount_Config::checkcurl()) $backends['\OC\Files\Storage\Google']=array( 'backend' => 'Google Drive', 'configuration' => array( 'configured' => '#configured', @@ -96,7 +96,7 @@ class OC_Mount_Config { 'share' => 'Share', 'root' => '&Root')); - $backends['\OC\Files\Storage\DAV']=array( + if(OC_Mount_Config::checkcurl()) $backends['\OC\Files\Storage\DAV']=array( 'backend' => 'ownCloud / WebDAV', 'configuration' => array( 'host' => 'URL', @@ -414,6 +414,13 @@ class OC_Mount_Config { } } + /** + * check if curl is installed + */ + public static function checkcurl() { + return (function_exists('curl_init')); + } + /** * check dependencies */ @@ -426,6 +433,9 @@ class OC_Mount_Config { if(!OC_Mount_Config::checkphpftp()) { $txt.=$l->t('Warning: The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it.').'
'; } + if(!OC_Mount_Config::checkcurl()) { + $txt.=$l->t('Warning: The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it.').'
'; + } return($txt); } -- 2.39.5