summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/appinfo
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2013-02-25 05:13:38 -0800
committerBjörn Schießle <bjoern@schiessle.org>2013-02-25 05:13:38 -0800
commita37577e007ef458e31d3484b5f969ea0e98545f3 (patch)
tree138645a5fd437be51cd3566bb9b4ca476850d57e /apps/files_trashbin/appinfo
parent3f48bebe924062cc01abc8c72019235a00f38b76 (diff)
parent7da97550df61e7a82463b91139e8f18923765bc9 (diff)
downloadnextcloud-server-a37577e007ef458e31d3484b5f969ea0e98545f3.tar.gz
nextcloud-server-a37577e007ef458e31d3484b5f969ea0e98545f3.zip
Merge pull request #1810 from owncloud/trashbin_encryption
Trashbin file encryption support
Diffstat (limited to 'apps/files_trashbin/appinfo')
-rw-r--r--apps/files_trashbin/appinfo/update.php40
-rw-r--r--apps/files_trashbin/appinfo/version2
2 files changed, 41 insertions, 1 deletions
diff --git a/apps/files_trashbin/appinfo/update.php b/apps/files_trashbin/appinfo/update.php
new file mode 100644
index 00000000000..b0bf79cc510
--- /dev/null
+++ b/apps/files_trashbin/appinfo/update.php
@@ -0,0 +1,40 @@
+<?php
+
+$installedVersion=OCP\Config::getAppValue('files_trashbin', 'installed_version');
+// move versions to new directory
+
+if (version_compare($installedVersion, '0.2', '<')) {
+ $datadir = \OCP\Config::getSystemValue('datadirectory').'/';
+
+ $users = \OCP\User::getUsers();
+ foreach ($users as $user) {
+
+ //create new folders
+ @mkdir($datadir.$user.'/files_trashbin/files');
+ @mkdir($datadir.$user.'/files_trashbin/versions');
+ @mkdir($datadir.$user.'/files_trashbin/keyfiles');
+
+ // move files to the new folders
+ if ($handle = opendir($datadir.$user.'/files_trashbin')) {
+ while (false !== ($file = readdir($handle))) {
+ if ($file != "." && $file != ".." && $file != 'files' && $file != 'versions' && $file != 'keyfiles') {
+ rename($datadir.$user.'/files_trashbin/'.$file,
+ $datadir.$user.'/files_trashbin/files/'.$file);
+ }
+ }
+ closedir($handle);
+ }
+
+ // move versions to the new folder
+ if ($handle = opendir($datadir.$user.'/versions_trashbin')) {
+ while (false !== ($file = readdir($handle))) {
+ rename($datadir.$user.'/versions_trashbin/'.$file,
+ $datadir.$user.'/files_trashbin/versions/'.$file);
+ }
+ closedir($handle);
+ }
+
+ @rmdir($datadir.$user.'/versions_trashbin');
+
+ }
+} \ No newline at end of file
diff --git a/apps/files_trashbin/appinfo/version b/apps/files_trashbin/appinfo/version
index 49d59571fbf..3b04cfb60da 100644
--- a/apps/files_trashbin/appinfo/version
+++ b/apps/files_trashbin/appinfo/version
@@ -1 +1 @@
-0.1
+0.2