]> source.dussan.org Git - nextcloud-server.git/commitdiff
set the init status to "NOT_INITIALIZED" if the encryption app gets enabled
authorBjoern Schiessle <schiessle@owncloud.com>
Tue, 22 Oct 2013 14:15:24 +0000 (16:15 +0200)
committerBjoern Schiessle <schiessle@owncloud.com>
Tue, 22 Oct 2013 14:15:24 +0000 (16:15 +0200)
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/helper.php
apps/files_encryption/lib/util.php

index d9a76becf25cfbc7527b8830e01438cfd4c4d706..ef216c2e2e7598f9cd0251c1b9b3f08a16f5a732 100644 (file)
@@ -555,4 +555,16 @@ class Hooks {
                }\r
        }\r
 \r
+       /**\r
+        * set the init status to 'NOT_INITIALIZED' (0) if the app gets enabled\r
+        * @param array $params contains the app ID\r
+        */\r
+       public static function postEnable($params) {\r
+               error_log("app was enabled!");\r
+               if ($params['app'] === 'files_encryption') {\r
+                       $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));\r
+                       $session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED);\r
+               }\r
+       }\r
+\r
 }\r
index a754f9f28c4bfd6b18046bb5daa888dc0cd31fa0..91dd08ec08dfde39e4509f20b21fdf6315fd1aa7 100755 (executable)
@@ -69,6 +69,7 @@ class Helper {
        public static function registerAppHooks() {
 
                \OCP\Util::connectHook('OC_App', 'pre_disable', 'OCA\Encryption\Hooks', 'preDisable');
+               \OCP\Util::connectHook('OC_App', 'post_disable', 'OCA\Encryption\Hooks', 'postEnable');
        }
 
        /**
index 53d58fbf40d601c6951d052f2f643f3a5b0a9b24..b9592a32cb2038bf8900a206556a987fed776c4b 100644 (file)
@@ -1278,7 +1278,7 @@ class Util {
                // If no record is found
                if (empty($migrationStatus)) {
                        \OCP\Util::writeLog('Encryption library', "Could not get migration status for " . $this->userId . ", no record found", \OCP\Util::ERROR);
-                       return false;
+                       return self::MIGRATION_OPEN;
                        // If a record is found
                } else {
                        return (int)$migrationStatus[0];