fix indention

This commit is contained in:
Björn Schießle 2013-06-14 15:14:23 +02:00
parent f91b02e9b6
commit c3371812a0
1 changed files with 310 additions and 319 deletions

View File

@ -24,6 +24,7 @@ namespace OCA\Files_Trashbin;
class Trashbin { class Trashbin {
// how long do we keep files in the trash bin if no other value is defined in the config file (unit: days) // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days)
const DEFAULT_RETENTION_OBLIGATION = 180; const DEFAULT_RETENTION_OBLIGATION = 180;
// unit: percentage; 50% of available disk space/quota // unit: percentage; 50% of available disk space/quota
@ -89,13 +90,11 @@ class Trashbin {
\OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR); \OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated', \OC_log::ERROR);
return; return;
} }
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => \OC\Files\Filesystem::normalizePath($file_path),
array('filePath' => \OC\Files\Filesystem::normalizePath($file_path),
'trashPath' => \OC\Files\Filesystem::normalizePath($filename . '.d' . $timestamp))); 'trashPath' => \OC\Files\Filesystem::normalizePath($filename . '.d' . $timestamp)));
$trashbinSize += self::retainVersions($view, $file_path, $filename, $timestamp); $trashbinSize += self::retainVersions($view, $file_path, $filename, $timestamp);
$trashbinSize += self::retainEncryptionKeys($view, $file_path, $filename, $timestamp); $trashbinSize += self::retainEncryptionKeys($view, $file_path, $filename, $timestamp);
} else { } else {
\OC_Log::write('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OC_log::ERROR); \OC_Log::write('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OC_log::ERROR);
} }
@ -103,7 +102,6 @@ class Trashbin {
$trashbinSize -= self::expire($trashbinSize); $trashbinSize -= self::expire($trashbinSize);
self::setTrashbinSize($user, $trashbinSize); self::setTrashbinSize($user, $trashbinSize);
} }
/** /**
@ -222,7 +220,6 @@ class Trashbin {
unlink($src); unlink($src);
} }
} }
} }
// enable proxy // enable proxy
@ -293,8 +290,7 @@ class Trashbin {
$view->chroot('/' . $user . '/files'); $view->chroot('/' . $user . '/files');
$view->touch('/' . $location . '/' . $filename . $ext, $mtime); $view->touch('/' . $location . '/' . $filename . $ext, $mtime);
$view->chroot($fakeRoot); $view->chroot($fakeRoot);
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', \OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', array('filePath' => \OC\Files\Filesystem::normalizePath('/' . $location . '/' . $filename . $ext),
array('filePath' => \OC\Files\Filesystem::normalizePath('/'.$location.'/'.$filename.$ext),
'trashPath' => \OC\Files\Filesystem::normalizePath($file))); 'trashPath' => \OC\Files\Filesystem::normalizePath($file)));
if ($view->is_dir($target . $ext)) { if ($view->is_dir($target . $ext)) {
$trashbinSize -= self::calculateSize(new \OC\Files\View('/' . $user . '/' . $target . $ext)); $trashbinSize -= self::calculateSize(new \OC\Files\View('/' . $user . '/' . $target . $ext));
@ -377,7 +373,6 @@ class Trashbin {
return $size; return $size;
} }
/** /**
* @brief restore encryption keys from trash bin * @brief restore encryption keys from trash bin
* *
@ -438,7 +433,6 @@ class Trashbin {
} }
$size += self::calculateSize(new \OC\Files\View($sharekey)); $size += self::calculateSize(new \OC\Files\View($sharekey));
$rootView->rename($sharekey, $owner . '/files_encryption/share-keys/' . $ownerPath); $rootView->rename($sharekey, $owner . '/files_encryption/share-keys/' . $ownerPath);
} else { } else {
// handle keyfiles // handle keyfiles
$size += $rootView->filesize($keyfile); $size += $rootView->filesize($keyfile);
@ -666,8 +660,7 @@ class Trashbin {
$query = \OC_DB::prepare('SELECT `location`,`type`,`id`,`timestamp` FROM `*PREFIX*files_trash` WHERE `user`=?'); $query = \OC_DB::prepare('SELECT `location`,`type`,`id`,`timestamp` FROM `*PREFIX*files_trash` WHERE `user`=?');
$result = $query->execute(array($user))->fetchAll(); $result = $query->execute(array($user))->fetchAll();
$retention_obligation = \OC_Config::getValue('trashbin_retention_obligation', $retention_obligation = \OC_Config::getValue('trashbin_retention_obligation', self::DEFAULT_RETENTION_OBLIGATION);
self::DEFAULT_RETENTION_OBLIGATION);
$limit = time() - ($retention_obligation * 86400); $limit = time() - ($retention_obligation * 86400);
@ -694,8 +687,6 @@ class Trashbin {
$size += $tmp; $size += $tmp;
$i++; $i++;
} }
} }
return $size; return $size;
@ -792,8 +783,7 @@ class Trashbin {
if (!file_exists($root)) { if (!file_exists($root)) {
return 0; return 0;
} }
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root), $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root), \RecursiveIteratorIterator::CHILD_FIRST);
\RecursiveIteratorIterator::CHILD_FIRST);
$size = 0; $size = 0;
foreach ($iterator as $path) { foreach ($iterator as $path) {
@ -845,4 +835,5 @@ class Trashbin {
//Listen to delete user signal //Listen to delete user signal
\OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Trashbin\Hooks", "deleteUser_hook"); \OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Trashbin\Hooks", "deleteUser_hook");
} }
} }