summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/appinfo/update.php
blob: 48262cffa1125a458eaed249b16c6da5f3a2f19d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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());

}