summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/ajax/delete.php
blob: fe41f53d49e6c749f892ce1570e5d0b03a92e8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();

$file = $_REQUEST['file'];

$path_parts = pathinfo($file);
if ($path_parts['dirname'] == '.') {
	$delimiter = strrpos($file, '.d');
	$filename = substr($file, 0, $delimiter);
	$timestamp =  substr($file, $delimiter+2);
} else {
	$filename = $file;
	$timestamp = null;
}
sleep(5);
if (OCA_Trash\Trashbin::delete($filename, $timestamp)) {
	error_log("feinifeini");
	OCP\JSON::success(array("data" => array("filename" => $file)));
} else {
	OCP\JSON::error(array("data" => array("message" => "Couldn't delete ".$file. " permanently")));
}