From: Bjoern Schiessle Date: Tue, 17 Sep 2013 14:53:52 +0000 (+0200) Subject: performance improvement, check configuration only if no private key exists X-Git-Tag: v6.0.0alpha2~168^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=72eaf2894a540bc9280e144ba493db7fcde07eac;p=nextcloud-server.git performance improvement, check configuration only if no private key exists --- diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index d40ae95a446..d9221c6e828 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -44,13 +44,18 @@ class Hooks { \OC_Util::setupFS($params['uid']); } - //check if all requirements are met - if(!Helper::checkRequirements() || !Helper::checkConfiguration()) { - $error_msg = $l->t("Missing requirements."); - $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.'); - \OC_App::disable('files_encryption'); - \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR); - \OCP\Template::printErrorPage($error_msg, $hint); + $privateKey = \OCA\Encryption\Keymanager::getPrivateKey($view, $params['uid']); + + // if no private key exists, check server configuration + if(!$privateKey) { + //check if all requirements are met + if(!Helper::checkRequirements() || !Helper::checkConfiguration()) { + $error_msg = $l->t("Missing requirements."); + $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.'); + \OC_App::disable('files_encryption'); + \OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR); + \OCP\Template::printErrorPage($error_msg, $hint); + } } $util = new Util($view, $params['uid']);