check filename and timestamp in Trashbin's file_exists method
This commit is contained in:
parent
4b4b1f8692
commit
c0ac98066e
|
@ -249,13 +249,21 @@ class Trashbin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check to see whether a file exists in 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
|
* @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();
|
$user = \OCP\User::getUser();
|
||||||
$view = new \OC_FilesystemView('/'.$user);
|
$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);
|
return $view->file_exists($target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue