summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2013-02-19 03:09:03 -0800
committerBjörn Schießle <bjoern@schiessle.org>2013-02-19 03:09:03 -0800
commit95751874a14c4fd9a52061823d8fe732b3ff3609 (patch)
tree99719e2ef150bb49903a6726dc7791a9d0e99790 /apps/files_trashbin/lib
parent3d7545269bae7aa38de2abbc4d327beab986fc82 (diff)
parentc0ac98066e717ac8dba98df5bbfe881c9b344495 (diff)
downloadnextcloud-server-95751874a14c4fd9a52061823d8fe732b3ff3609.tar.gz
nextcloud-server-95751874a14c4fd9a52061823d8fe732b3ff3609.zip
Merge pull request #1740 from houqp/issue#1688
Bug fix for Issue#1688
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/trash.php23
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