Skip to content
Snippets Groups Projects
Commit 3d49631b authored by Björn Schießle's avatar Björn Schießle
Browse files

make sure that initial encryption also starts for a fresh installation

parent 84aba454
No related branches found
No related tags found
No related merge requests found
...@@ -44,10 +44,8 @@ class Hooks { ...@@ -44,10 +44,8 @@ class Hooks {
\OC_Util::setupFS($params['uid']); \OC_Util::setupFS($params['uid']);
} }
$util = new Util($view, $params['uid']);
//check if all requirements are met //check if all requirements are met
if(!$util->ready() && (!Helper::checkRequirements() || !Helper::checkConfiguration())) { if(!Helper::checkRequirements() || !Helper::checkConfiguration()) {
$error_msg = $l->t("Missing requirements."); $error_msg = $l->t("Missing requirements.");
$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.'); $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.');
\OC_App::disable('files_encryption'); \OC_App::disable('files_encryption');
...@@ -55,6 +53,8 @@ class Hooks { ...@@ -55,6 +53,8 @@ class Hooks {
\OCP\Template::printErrorPage($error_msg, $hint); \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;
...@@ -73,7 +73,7 @@ class Hooks { ...@@ -73,7 +73,7 @@ class Hooks {
$userView = new \OC_FilesystemView('/' . $params['uid']); $userView = new \OC_FilesystemView('/' . $params['uid']);
// Set legacy encryption key if it exists, to support // Set legacy encryption key if it exists, to support
// depreciated encryption system // depreciated encryption system
if ( if (
$userView->file_exists('encryption.key') $userView->file_exists('encryption.key')
...@@ -249,7 +249,7 @@ class Hooks { ...@@ -249,7 +249,7 @@ class Hooks {
$params['run'] = false; $params['run'] = false;
$params['error'] = $l->t('Following users are not set up for encryption:') . ' ' . join(', ' , $notConfigured); $params['error'] = $l->t('Following users are not set up for encryption:') . ' ' . join(', ' , $notConfigured);
} }
} }
/** /**
...@@ -260,7 +260,7 @@ class Hooks { ...@@ -260,7 +260,7 @@ class Hooks {
// NOTE: $params has keys: // NOTE: $params has keys:
// [itemType] => file // [itemType] => file
// itemSource -> int, filecache file ID // itemSource -> int, filecache file ID
// [parent] => // [parent] =>
// [itemTarget] => /13 // [itemTarget] => /13
// shareWith -> string, uid of user being shared to // shareWith -> string, uid of user being shared to
// fileTarget -> path of file being shared // fileTarget -> path of file being shared
...@@ -301,13 +301,13 @@ class Hooks { ...@@ -301,13 +301,13 @@ class Hooks {
// NOTE: parent is folder but shared was a file! // NOTE: parent is folder but shared was a file!
// we try to rebuild the missing path // we try to rebuild the missing path
// some examples we face here // some examples we face here
// user1 share folder1 with user2 folder1 has // user1 share folder1 with user2 folder1 has
// the following structure // the following structure
// /folder1/subfolder1/subsubfolder1/somefile.txt // /folder1/subfolder1/subsubfolder1/somefile.txt
// user2 re-share subfolder2 with user3 // user2 re-share subfolder2 with user3
// user3 re-share somefile.txt user4 // user3 re-share somefile.txt user4
// so our path should be // so our path should be
// /Shared/subfolder1/subsubfolder1/somefile.txt // /Shared/subfolder1/subsubfolder1/somefile.txt
// while user3 is sharing // while user3 is sharing
if ($params['itemType'] === 'file') { if ($params['itemType'] === 'file') {
......
...@@ -201,10 +201,11 @@ class Util { ...@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment