diff options
Diffstat (limited to 'apps/files_external/lib/config.php')
-rwxr-xr-x | apps/files_external/lib/config.php | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 4e82e6b2548..5630df77a91 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -244,7 +244,8 @@ class OC_Mount_Config { */
public static function getCertificates() { $view = \OCP\Files::getStorage('files_external'); - $path=\OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath(""); + $path=\OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("").'uploads/'; + if (!is_dir($path)) mkdir($path); $result = array(); $handle = opendir($path); while (false !== ($file = readdir($handle))) { @@ -252,6 +253,30 @@ class OC_Mount_Config { } return $result; } + + /** + * creates certificate bundle + */ + public static function createCertificateBundle() { + $view = \OCP\Files::getStorage("files_external");
+ $path = \OCP\Config::getSystemValue('datadirectory').$view->getAbsolutePath("");
+
+ $certs = OC_Mount_Config::getCertificates();
+ $fh_certs = fopen($path."/rootcerts.crt", 'w');
+ foreach ($certs as $cert) {
+ $file=$path.'/uploads/'.$cert;
+ $fh = fopen($file, "r");
+ $data = fread($fh, filesize($file));
+ fclose($fh); + if (strpos($data, 'BEGIN CERTIFICATE')) {
+ fwrite($fh_certs, $data); + }
+ }
+
+ fclose($fh_certs); + + return true; + } } |