aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/hooks
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-06-27 14:09:22 +0200
committerBjörn Schießle <schiessle@owncloud.com>2013-06-27 14:09:22 +0200
commitc4aef892788ced15812cc31abcf34c085b66ce5a (patch)
tree3d7968d428c24512be18a6ccad09923bd5e54af6 /apps/files_encryption/hooks
parentaa7403500fdbc76b9e63b0de1553e1a4f61a4cf2 (diff)
downloadnextcloud-server-c4aef892788ced15812cc31abcf34c085b66ce5a.tar.gz
nextcloud-server-c4aef892788ced15812cc31abcf34c085b66ce5a.zip
introduce pre-disable-app hook and use it for the encryption app to reset migration status if the app was disabled
Diffstat (limited to 'apps/files_encryption/hooks')
-rw-r--r--apps/files_encryption/hooks/hooks.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index e39e068cc5d..09153918940 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -543,4 +543,17 @@ class Hooks {
\OC_FileProxy::$enabled = $proxyStatus;
}
+
+ /**
+ * set migration status back to '0' so that all new files get encrypted
+ * if the app gets enabled again
+ * @param array $params contains the app ID
+ */
+ public static function preDisable($params) {
+ if ($params['app'] === 'files_encryption') {
+ $query = \OC_DB::prepare('UPDATE `*PREFIX*encryption` SET `migration_status`=0');
+ $query->execute();
+ }
+ }
+
}