$view = new OC_FilesystemView('/');
- $sessionReady = false;
- if(extension_loaded("openssl")) {
+ $sessionReady = OCA\Encryption\Helper::checkRequirements();
+ if($sessionReady) {
$session = new \OCA\Encryption\Session($view);
- $sessionReady = true;
}
$user = \OCP\USER::getUser();
*/\r
public static function login($params) {\r
$l = new \OC_L10N('files_encryption');\r
- //check if openssl is available\r
- if(!extension_loaded("openssl") ) {\r
- $error_msg = $l->t("PHP module OpenSSL is not installed.");\r
- $hint = $l->t('Please ask your server administrator to install the module. For now the encryption app was disabled.');\r
+ //check if all requirements are met\r
+ if(!Helper::checkRequirements() ) {\r
+ $error_msg = $l->t("Missing requirements.");\r
+ $hint = $l->t('Please make sure that the OpenSSL module and PHP >0 5.3.3 is installed. For now the encryption app was 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
header('Location: ' . $location . '?p=' . $post);
exit();
}
+
+
+ /**
+ * check requirements for encryptoin app.
+ * @return bool true if requirements are met
+ */
+ public static function checkRequirements() {
+ $result = true;
+
+ //openssl extension needs to be loaded
+ $result &= extension_loaded("openssl");
+ // we need php >= 5.3.3
+ $result &= version_compare(phpversion(), '5.3.11', '>=');
+
+ return $result;
+ }
}
\ No newline at end of file