summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/ajax/delete.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/ajax/delete.php')
-rw-r--r--apps/files_trashbin/ajax/delete.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/files_trashbin/ajax/delete.php b/apps/files_trashbin/ajax/delete.php
new file mode 100644
index 00000000000..a166ce55c88
--- /dev/null
+++ b/apps/files_trashbin/ajax/delete.php
@@ -0,0 +1,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;
+}
+
+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")));
+}
+