]> source.dussan.org Git - nextcloud-server.git/commitdiff
add file_exists method to files_trashbin app
authorQingping Hou <dave2008713@gmail.com>
Sat, 16 Feb 2013 22:42:06 +0000 (17:42 -0500)
committerQingping Hou <dave2008713@gmail.com>
Sat, 16 Feb 2013 22:42:06 +0000 (17:42 -0500)
apps/files_trashbin/lib/trash.php

index d88dc1ac252b7446847ab89d90d51eef3df73fc2..8cb44d0a6848775d411b3096be66f1b810e8e4b0 100644 (file)
@@ -246,8 +246,19 @@ class Trashbin {
                \r
                return $size;\r
        }
-       
-       
+
+       /**
+        * check to see whether a file exists in trashbin
+        * @param $file path to the file to check
+        * @return true if file exists, otherwise false
+        */
+       public static function file_exists($file) {
+               $user = \OCP\User::getUser();
+               $view = new \OC_FilesystemView('/'.$user);
+               $target = \OC_Filesystem::normalizePath('files_trashbin/'.$file);
+               return $view->file_exists($target);
+       }
+
        /**\r
         * clean up the trash bin
         * @param max. available disk space for trashbin\r