// Filesystem related hooks
OCA\Encryption\Helper::registerFilesystemHooks();
+ // App manager related hooks
+ OCA\Encryption\Helper::registerAppHooks();
+
stream_wrapper_register('crypt', 'OCA\Encryption\Stream');
// check if we are logged in
\r
\OC_FileProxy::$enabled = $proxyStatus;\r
}\r
+\r
+ /**\r
+ * set migration status back to '0' so that all new files get encrypted\r
+ * if the app gets enabled again\r
+ * @param array $params contains the app ID\r
+ */\r
+ public static function preDisable($params) {\r
+ if ($params['app'] === 'files_encryption') {\r
+ $query = \OC_DB::prepare('UPDATE `*PREFIX*encryption` SET `migration_status`=0');\r
+ $query->execute();\r
+ }\r
+ }\r
+\r
}\r
\OCP\Util::connectHook('OC_Filesystem', 'post_rename', 'OCA\Encryption\Hooks', 'postRename');
}
+ /**
+ * @brief register filesystem related hooks
+ *
+ */
+ public static function registerAppHooks() {
+
+ \OCP\Util::connectHook('OC_App', 'pre_disable', 'OCA\Encryption\Hooks', 'preDisable');
+ }
+
/**
* @brief setup user for files_encryption
*
*/
public static function disable( $app ) {
// check if app is a shipped app or not. if not delete
+ \OC_Hook::emit('OC_App', 'pre_disable', array('app' => $app));
OC_Appconfig::setValue( $app, 'enabled', 'no' );
// check if app is a shipped app or not. if not delete