summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/appinfo/update.php
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-04-09 15:27:19 +0200
committerBjörn Schießle <schiessle@owncloud.com>2013-04-10 10:09:37 +0200
commit48dabd2c145be296b575fe1ff47b800fc31e06ee (patch)
treeb6e6cb8a6d0a35b1f5d87a15f9cd671ddfcb157e /apps/files_trashbin/appinfo/update.php
parent16b0855992a984b238ac5bb33154dee18a52954a (diff)
downloadnextcloud-server-48dabd2c145be296b575fe1ff47b800fc31e06ee.tar.gz
nextcloud-server-48dabd2c145be296b575fe1ff47b800fc31e06ee.zip
size of the trash bin could be incorrect, remove it for all users to enforce a recalculation during next usage.
Diffstat (limited to 'apps/files_trashbin/appinfo/update.php')
-rw-r--r--apps/files_trashbin/appinfo/update.php40
1 files changed, 5 insertions, 35 deletions
diff --git a/apps/files_trashbin/appinfo/update.php b/apps/files_trashbin/appinfo/update.php
index b0bf79cc510..f4dad7b26bf 100644
--- a/apps/files_trashbin/appinfo/update.php
+++ b/apps/files_trashbin/appinfo/update.php
@@ -1,40 +1,10 @@
<?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');
-
- }
+if (version_compare($installedVersion, '0.4', '<')) {
+ //size of the trash bin could be incorrect, remove it for all users to
+ //enforce a recalculation during next usage.
+ $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trashsize`');
+ $result = $query->execute();
} \ No newline at end of file