catch broken server config and disable encryption app.

This commit is contained in:
Bjoern Schiessle 2013-08-01 11:50:56 +02:00
parent 0deae7b86f
commit cfbdad9cdb
2 changed files with 13 additions and 1 deletions

View File

@ -40,7 +40,7 @@ class Hooks {
public static function login($params) {
$l = new \OC_L10N('files_encryption');
//check if all requirements are met
if(!Helper::checkRequirements() ) {
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 the OpenSSL PHP extension is enabled and configured properly. For now, the encryption app has been disabled.');
\OC_App::disable('files_encryption');

View File

@ -232,6 +232,18 @@ class Helper {
return (bool) $result;
}
/**
* check some common errors if the server isn't configured properly for encryption
* @return bool true if configuration seems to be OK
*/
public static function checkConfiguration() {
if(openssl_pkey_new(array('private_key_bits' => 4096))) {
return true;
} else {
return false;
}
}
/**
* @brief glob uses different pattern than regular expressions, escape glob pattern only