]> source.dussan.org Git - nextcloud-server.git/commitdiff
make sure that initial encryption also starts for a fresh installation
authorBjoern Schiessle <schiessle@owncloud.com>
Tue, 3 Sep 2013 11:24:30 +0000 (13:24 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Tue, 3 Sep 2013 11:24:30 +0000 (13:24 +0200)
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/util.php

index 85169e6a1d099d46389de25fd771c40dcabfc209..d40ae95a446ebbb1c67e5d4d4d7fc585de856e64 100644 (file)
@@ -44,10 +44,8 @@ class Hooks {
                        \OC_Util::setupFS($params['uid']);\r
                }\r
 \r
-               $util = new Util($view, $params['uid']);\r
-\r
                //check if all requirements are met\r
-               if(!$util->ready() && (!Helper::checkRequirements() || !Helper::checkConfiguration())) {\r
+               if(!Helper::checkRequirements() || !Helper::checkConfiguration()) {\r
                        $error_msg = $l->t("Missing requirements.");\r
                        $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.');\r
                        \OC_App::disable('files_encryption');\r
@@ -55,6 +53,8 @@ class Hooks {
                        \OCP\Template::printErrorPage($error_msg, $hint);\r
                }\r
 \r
+               $util = new Util($view, $params['uid']);\r
+\r
                // setup user, if user not ready force relogin\r
                if (Helper::setupUser($util, $params['password']) === false) {\r
                        return false;\r
@@ -73,7 +73,7 @@ class Hooks {
 \r
                        $userView = new \OC_FilesystemView('/' . $params['uid']);\r
 \r
-                       // Set legacy encryption key if it exists, to support \r
+                       // Set legacy encryption key if it exists, to support\r
                        // depreciated encryption system\r
                        if (\r
                                $userView->file_exists('encryption.key')\r
@@ -249,7 +249,7 @@ class Hooks {
                        $params['run'] = false;\r
                        $params['error'] = $l->t('Following users are not set up for encryption:') . ' ' . join(', ' , $notConfigured);\r
                }\r
-               \r
+\r
        }\r
 \r
        /**\r
@@ -260,7 +260,7 @@ class Hooks {
                // NOTE: $params has keys:\r
                // [itemType] => file\r
                // itemSource -> int, filecache file ID\r
-               // [parent] => \r
+               // [parent] =>\r
                // [itemTarget] => /13\r
                // shareWith -> string, uid of user being shared to\r
                // fileTarget -> path of file being shared\r
@@ -301,13 +301,13 @@ class Hooks {
                                        // NOTE: parent is folder but shared was a file!\r
                                        // we try to rebuild the missing path\r
                                        // some examples we face here\r
-                                       // user1 share folder1 with user2 folder1 has \r
-                                       // the following structure \r
+                                       // user1 share folder1 with user2 folder1 has\r
+                                       // the following structure\r
                                        // /folder1/subfolder1/subsubfolder1/somefile.txt\r
                                        // user2 re-share subfolder2 with user3\r
                                        // user3 re-share somefile.txt user4\r
-                                       // so our path should be \r
-                                       // /Shared/subfolder1/subsubfolder1/somefile.txt \r
+                                       // so our path should be\r
+                                       // /Shared/subfolder1/subsubfolder1/somefile.txt\r
                                        // while user3 is sharing\r
 \r
                                        if ($params['itemType'] === 'file') {\r
index b8d6862349395efa1a02b7039b267cee87faa700..9bc5300076afcefa7625e45bc5fc1c29fa9a513f 100644 (file)
@@ -201,10 +201,11 @@ class Util {
                if (false === $this->recoveryEnabledForUser()) {
 
                        // 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(
                                $this->userId,
                                'server-side',
+                               0,
                                0
                        );
                        $query = \OCP\DB::prepare($sql);