diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-02-20 18:00:15 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-02-20 18:00:15 +0100 |
commit | 5ce6d1fb5774bdc7dacea4c853d5412f03004e0c (patch) | |
tree | d70bbc463d30c946888b4bff591a15e09041a557 /apps | |
parent | 4b5a662e09e1f1d0b7885b546e7b278fe263be34 (diff) | |
download | nextcloud-server-5ce6d1fb5774bdc7dacea4c853d5412f03004e0c.tar.gz nextcloud-server-5ce6d1fb5774bdc7dacea4c853d5412f03004e0c.zip |
reuse delete() function in expire()
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_trashbin/lib/trash.php | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 5c0cf36f5b3..4d230449b59 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -322,27 +322,10 @@ class Trashbin { $timestamp = $r['timestamp']; $filename = $r['id']; if ( $r['timestamp'] < $limit ) { - if ($view->is_dir('files_trashbin/files/'.$filename.'.d'.$timestamp)) { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/files/'.$filename.'.d'.$timestamp)); - } else { - $size += $view->filesize('files_trashbin/files/'.$filename.'.d'.$timestamp); - } - $view->unlink('files_trashbin/files/'.$filename.'.d'.$timestamp); - if ($r['type'] == 'dir') { - $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/versions'.$filename.'.d'.$timestamp)); - $view->unlink('files_trashbin/versions'.$filename.'.d'.$timestamp); - } else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) { - foreach ($versions as $v) { - $size += $view->filesize('files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); - $view->unlink('files_trashbin/versions/'.$filename.'.v'.$v.'.d'.$timestamp); - } - } + $size += self::delete($filename, $timestamp); } } - - $query = \OC_DB::prepare('DELETE FROM *PREFIX*files_trash WHERE user=? AND timestamp<?');
- $query->execute(array($user,$limit)); - + $availableSpace = $availableSpace + $size; // if size limit for trash bin reached, delete oldest files in trash bin if ($availableSpace < 0) { @@ -355,8 +338,7 @@ class Trashbin { $availableSpace += $tmp; $size += $tmp; $i++; - } - + } } return $size;
|