summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/appinfo/update.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_encryption/appinfo/update.php')
-rw-r--r--apps/files_encryption/appinfo/update.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/files_encryption/appinfo/update.php b/apps/files_encryption/appinfo/update.php
new file mode 100644
index 00000000000..48262cffa11
--- /dev/null
+++ b/apps/files_encryption/appinfo/update.php
@@ -0,0 +1,19 @@
+<?php
+
+$installedVersion=OCP\Config::getAppValue('files_encryption', 'installed_version');
+// migrate settings from oc_encryption to oc_preferences
+if (version_compare($installedVersion, '0.6', '<')) {
+ $sql = 'SELECT * FROM `*PREFIX*encryption`';
+ $query = \OCP\DB::prepare($sql);
+ $result = $query->execute(array())->fetchAll();
+
+ foreach ($result as $row) {
+ \OC_Preferences::setValue($row['uid'], 'files_encryption', 'recovery_enabled', $row['recovery_enabled']);
+ \OC_Preferences::setValue($row['uid'], 'files_encryption', 'migration_status', $row['migration_status']);
+ }
+
+ $deleteOldTable = 'DROP TABLE `*PREFIX*encryption`';
+ $query = \OCP\DB::prepare($deleteOldTable);
+ $query->execute(array());
+
+}