diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index d9a76becf25cfbc7527b8830e01438cfd4c4d706..6e2d360917bc1fc30525d69788c88616e318c36d 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -555,4 +555,15 @@ class Hooks { } } + /** + * set the init status to 'NOT_INITIALIZED' (0) if the app gets enabled + * @param array $params contains the app ID + */ + public static function postEnable($params) { + if ($params['app'] === 'files_encryption') { + $session = new \OCA\Encryption\Session(new \OC\Files\View('/')); + $session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED); + } + } + } diff --git a/apps/files_encryption/lib/helper.php b/apps/files_encryption/lib/helper.php index a754f9f28c4bfd6b18046bb5daa888dc0cd31fa0..91dd08ec08dfde39e4509f20b21fdf6315fd1aa7 100755 --- a/apps/files_encryption/lib/helper.php +++ b/apps/files_encryption/lib/helper.php @@ -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'); } /** diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 53d58fbf40d601c6951d052f2f643f3a5b0a9b24..b9592a32cb2038bf8900a206556a987fed776c4b 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -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]; diff --git a/lib/private/app.php b/lib/private/app.php index 6f45b6e6dd7218baecddbf02f4ece5eb294e21d4..eca40a81cc14c9e9576fdcc958ace8143598b74a 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -249,6 +249,7 @@ class OC_App{ if(isset($appdata['id'])) { OC_Appconfig::setValue( $app, 'ocsid', $appdata['id'] ); } + \OC_Hook::emit('OC_App', 'post_enable', array('app' => $app)); } }else{ throw new \Exception($l->t("No app name specified"));