check filename and timestamp in Trashbin's file_exists method

This commit is contained in:
Qingping Hou 2013-02-18 09:49:50 -05:00
parent 4b4b1f8692
commit c0ac98066e

View File

@ -249,13 +249,21 @@ class Trashbin {
/**
* check to see whether a file exists in trashbin
* @param $file path to the file to check
* @param $filename path to the file
* @param $timestamp of deletion time
* @return true if file exists, otherwise false
*/
public static function file_exists($file) {
public static function file_exists($filename, $timestamp=null) {
$user = \OCP\User::getUser();
$view = new \OC_FilesystemView('/'.$user);
$target = \OC_Filesystem::normalizePath('files_trashbin/'.$file);
if ($timestamp) {
$filename = $filename.'.d'.$timestamp;
} else {
$filename = $filename;
}
$target = \OC_Filesystem::normalizePath('files_trashbin/'.$filename);
return $view->file_exists($target);
}