Merge pull request #3899 from owncloud/encryption_check_php_version
check php version, the encryption app needs php >= 5.3.3
This commit is contained in:
commit
f67fc78531
|
@ -37,10 +37,9 @@ if (!OC_Config::getValue('maintenance', false)) {
|
|||
|
||||
$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();
|
||||
|
|
|
@ -21,4 +21,3 @@ if (!isset($_)) { //also provide standalone error page
|
|||
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -39,10 +39,10 @@ class Hooks {
|
|||
*/
|
||||
public static function login($params) {
|
||||
$l = new \OC_L10N('files_encryption');
|
||||
//check if openssl is available
|
||||
if(!extension_loaded("openssl") ) {
|
||||
$error_msg = $l->t("PHP module OpenSSL is not installed.");
|
||||
$hint = $l->t('Please ask your server administrator to install the module. For now the encryption app was disabled.');
|
||||
//check if all requirements are met
|
||||
if(!Helper::checkRequirements() ) {
|
||||
$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');
|
||||
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR);
|
||||
\OCP\Template::printErrorPage($error_msg, $hint);
|
||||
|
|
|
@ -132,7 +132,7 @@ class Helper {
|
|||
|
||||
$view->file_put_contents('/public-keys/' . $recoveryKeyId . '.public.key', $keypair['publicKey']);
|
||||
|
||||
// Encrypt private key empthy passphrase
|
||||
// Encrypt private key empty passphrase
|
||||
$encryptedPrivateKey = \OCA\Encryption\Crypt::symmetricEncryptFileContent($keypair['privateKey'], $recoveryPassword);
|
||||
|
||||
// Save private key
|
||||
|
@ -217,4 +217,20 @@ class Helper {
|
|||
header('Location: ' . $location . '?p=' . $post);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check requirements for encryption 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.3', '>=');
|
||||
|
||||
return (bool) $result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue