diff options
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r-- | apps/files_trashbin/lib/trash.php | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index fbc3954c040..8d54a471b42 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -246,8 +246,27 @@ class Trashbin { return $size;
} - - + + /** + * check to see whether a file exists in trashbin + * @param $filename path to the file + * @param $timestamp of deletion time + * @return true if file exists, otherwise false + */ + public static function file_exists($filename, $timestamp=null) { + $user = \OCP\User::getUser(); + $view = new \OC_FilesystemView('/'.$user); + + if ($timestamp) { + $filename = $filename.'.d'.$timestamp; + } else { + $filename = $filename; + } + + $target = \OC_Filesystem::normalizePath('files_trashbin/'.$filename); + return $view->file_exists($target); + } + /**
* clean up the trash bin * @param max. available disk space for trashbin
|