summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/ajax/delete.php
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-02-06 16:23:22 +0100
committerBjörn Schießle <schiessle@owncloud.com>2013-02-06 16:23:22 +0100
commite2516a2b65185bd3081361d0b8f25e6eaf7d698f (patch)
tree6b982ece824887e497cee652e435f94af7a0e2f1 /apps/files_trashbin/ajax/delete.php
parent9e08f85c5e8b57d759cecc9ca145a816e121fe6c (diff)
downloadnextcloud-server-e2516a2b65185bd3081361d0b8f25e6eaf7d698f.tar.gz
nextcloud-server-e2516a2b65185bd3081361d0b8f25e6eaf7d698f.zip
allow to delete single files from the trash bin permanently
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..fe41f53d49e
--- /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;
+}
+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")));
+}
+