mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
commit
95751874a1
2 changed files with 24 additions and 3 deletions
|
|
@ -15,7 +15,9 @@ if ($path_parts['dirname'] == '.') {
|
|||
$timestamp = null;
|
||||
}
|
||||
|
||||
if (OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp)) {
|
||||
OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp);
|
||||
|
||||
if (!OCA\Files_Trashbin\Trashbin::file_exists($filename)) {
|
||||
OCP\JSON::success(array("data" => array("filename" => $file)));
|
||||
} else {
|
||||
$l = OC_L10N::get('files_trashbin');
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue