check php version, the encryption app needs php >= 5.3.3
This commit is contained in:
parent
cb5811bcf5
commit
adcee5b695
|
@ -34,10 +34,9 @@ if (!OC_Config::getValue('maintenance', false)) {
|
||||||
|
|
||||||
$view = new OC_FilesystemView('/');
|
$view = new OC_FilesystemView('/');
|
||||||
|
|
||||||
$sessionReady = false;
|
$sessionReady = OCA\Encryption\Helper::checkRequirements();
|
||||||
if(extension_loaded("openssl")) {
|
if($sessionReady) {
|
||||||
$session = new \OCA\Encryption\Session($view);
|
$session = new \OCA\Encryption\Session($view);
|
||||||
$sessionReady = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = \OCP\USER::getUser();
|
$user = \OCP\USER::getUser();
|
||||||
|
|
|
@ -39,10 +39,10 @@ class Hooks {
|
||||||
*/
|
*/
|
||||||
public static function login($params) {
|
public static function login($params) {
|
||||||
$l = new \OC_L10N('files_encryption');
|
$l = new \OC_L10N('files_encryption');
|
||||||
//check if openssl is available
|
//check if all requirements are met
|
||||||
if(!extension_loaded("openssl") ) {
|
if(!Helper::checkRequirements() ) {
|
||||||
$error_msg = $l->t("PHP module OpenSSL is not installed.");
|
$error_msg = $l->t("Missing requirements.");
|
||||||
$hint = $l->t('Please ask your server administrator to install the module. For now the encryption app was disabled.');
|
$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.');
|
||||||
\OC_App::disable('files_encryption');
|
\OC_App::disable('files_encryption');
|
||||||
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
|
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
|
||||||
\OCP\Template::printErrorPage($error_msg, $hint);
|
\OCP\Template::printErrorPage($error_msg, $hint);
|
||||||
|
|
|
@ -208,4 +208,20 @@ class Helper {
|
||||||
header('Location: ' . $location . '?p=' . $post);
|
header('Location: ' . $location . '?p=' . $post);
|
||||||
exit();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue