diff options
author | Björn Schießle <bjoern@schiessle.org> | 2013-10-23 01:02:45 -0700 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2013-10-23 01:02:45 -0700 |
commit | 2d14daf36bf6c808e55895c78b42144942b73246 (patch) | |
tree | 67f7399728b12948cdaebb0f6acd08482b7a42c6 | |
parent | 4bf37f72b2a263aa19db5ea47f05d5ddcc802162 (diff) | |
parent | 3d1d44352979436e2cd9dc93d5a097184907f335 (diff) | |
download | nextcloud-server-2d14daf36bf6c808e55895c78b42144942b73246.tar.gz nextcloud-server-2d14daf36bf6c808e55895c78b42144942b73246.zip |
Merge pull request #5472 from owncloud/enc_init_status_on_enable
Encryption set init status on enable
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 11 | ||||
-rwxr-xr-x | apps/files_encryption/lib/helper.php | 1 | ||||
-rw-r--r-- | apps/files_encryption/lib/util.php | 2 | ||||
-rw-r--r-- | lib/private/app.php | 1 |
4 files changed, 14 insertions, 1 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index d9a76becf25..6e2d360917b 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 a754f9f28c4..91dd08ec08d 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 53d58fbf40d..b9592a32cb2 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 6f45b6e6dd7..eca40a81cc1 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")); |