]> source.dussan.org Git - nextcloud-server.git/commitdiff
performance improvement, check configuration only if no private key exists
authorBjoern Schiessle <schiessle@owncloud.com>
Tue, 17 Sep 2013 14:53:52 +0000 (16:53 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Tue, 17 Sep 2013 14:53:52 +0000 (16:53 +0200)
apps/files_encryption/hooks/hooks.php

index d40ae95a446ebbb1c67e5d4d4d7fc585de856e64..d9221c6e828a2539ed61ffe184f7e589ca978444 100644 (file)
@@ -44,13 +44,18 @@ class Hooks {
                        \OC_Util::setupFS($params['uid']);\r
                }\r
 \r
-               //check if all requirements are met\r
-               if(!Helper::checkRequirements() || !Helper::checkConfiguration()) {\r
-                       $error_msg = $l->t("Missing requirements.");\r
-                       $hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');\r
-                       \OC_App::disable('files_encryption');\r
-                       \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);\r
-                       \OCP\Template::printErrorPage($error_msg, $hint);\r
+               $privateKey = \OCA\Encryption\Keymanager::getPrivateKey($view, $params['uid']);\r
+\r
+               // if no private key exists, check server configuration\r
+               if(!$privateKey) {\r
+                       //check if all requirements are met\r
+                       if(!Helper::checkRequirements() || !Helper::checkConfiguration()) {\r
+                               $error_msg = $l->t("Missing requirements.");\r
+                               $hint = $l->t('Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');\r
+                               \OC_App::disable('files_encryption');\r
+                               \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);\r
+                               \OCP\Template::printErrorPage($error_msg, $hint);\r
+                       }\r
                }\r
 \r
                $util = new Util($view, $params['uid']);\r