Merge branch 'master' into fix_3728_with_file_exists_dialog

This commit is contained in:
Jörn Friedrich Dreyer 2013-09-18 14:15:28 +02:00
commit ec1949f5ed
3 changed files with 25 additions and 17 deletions

View File

@ -25,7 +25,9 @@ if (!OC_Config::getValue('maintenance', false)) {
// App manager related hooks // App manager related hooks
OCA\Encryption\Helper::registerAppHooks(); OCA\Encryption\Helper::registerAppHooks();
stream_wrapper_register('crypt', 'OCA\Encryption\Stream'); if(!in_array('crypt', stream_get_wrappers())) {
stream_wrapper_register('crypt', 'OCA\Encryption\Stream');
}
// check if we are logged in // check if we are logged in
if (OCP\User::isLoggedIn()) { if (OCP\User::isLoggedIn()) {

View File

@ -44,17 +44,22 @@ class Hooks {
\OC_Util::setupFS($params['uid']); \OC_Util::setupFS($params['uid']);
} }
$util = new Util($view, $params['uid']); $privateKey = \OCA\Encryption\Keymanager::getPrivateKey($view, $params['uid']);
//check if all requirements are met // if no private key exists, check server configuration
if(!$util->ready() && (!Helper::checkRequirements() || !Helper::checkConfiguration())) { if(!$privateKey) {
$error_msg = $l->t("Missing requirements."); //check if all requirements are met
$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.'); if(!Helper::checkRequirements() || !Helper::checkConfiguration()) {
\OC_App::disable('files_encryption'); $error_msg = $l->t("Missing requirements.");
\OCP\Util::writeLog('Encryption library', $error_msg . ' ' . $hint, \OCP\Util::ERROR); $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.');
\OCP\Template::printErrorPage($error_msg, $hint); \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']);
// setup user, if user not ready force relogin // setup user, if user not ready force relogin
if (Helper::setupUser($util, $params['password']) === false) { if (Helper::setupUser($util, $params['password']) === false) {
return false; return false;

View File

@ -201,10 +201,11 @@ class Util {
if (false === $this->recoveryEnabledForUser()) { if (false === $this->recoveryEnabledForUser()) {
// create database configuration // create database configuration
$sql = 'INSERT INTO `*PREFIX*encryption` (`uid`,`mode`,`recovery_enabled`) VALUES (?,?,?)'; $sql = 'INSERT INTO `*PREFIX*encryption` (`uid`,`mode`,`recovery_enabled`,`migration_status`) VALUES (?,?,?,?)';
$args = array( $args = array(
$this->userId, $this->userId,
'server-side', 'server-side',
0,
0 0
); );
$query = \OCP\DB::prepare($sql); $query = \OCP\DB::prepare($sql);