diff --git a/mnemo/docs/CHANGES b/mnemo/docs/CHANGES
index 4a04fac3b3b..887ec020010 100644
--- a/mnemo/docs/CHANGES
+++ b/mnemo/docs/CHANGES
@@ -2,8 +2,8 @@
v4.3.0-git
----------
-[jan] Add put() method to API to support WebDAV PUT requests.
-[jan] Add browse() method to API to support WebDAV access.
+[jan] Add browse(), put(), and path_delete() methods to API to support WebDAV
+ access.
------
diff --git a/mnemo/lib/Api.php b/mnemo/lib/Api.php
index c7e340dfc55..aba4faadd28 100644
--- a/mnemo/lib/Api.php
+++ b/mnemo/lib/Api.php
@@ -307,6 +307,41 @@ public function put($path, $content, $content_type)
return array($memo['uid']);
}
+ /**
+ * Deletes a file from the Mnemo tree.
+ *
+ * @param string $path The path to the file.
+ *
+ * @return string The note's UID
+ * @throws Mnemo_Exception
+ */
+ public function path_delete($path)
+ {
+ if (substr($path, 0, 5) == 'mnemo') {
+ $path = substr($path, 5);
+ }
+ $path = trim($path, '/');
+ $parts = explode('/', $path);
+
+ if (count($parts) != 3 ||
+ !Mnemo::hasPermission($parts[1], Horde_Perms::DELETE)) {
+
+ throw new Mnemo_Exception(_("Notepad does not exist or no permission to delete"), 403);
+ }
+ $notepadID = $parts[1];
+
+ /* Create a Mnemo storage instance. */
+ try {
+ $storage = $GLOBALS['injector']
+ ->getInstance('Mnemo_Factory_Driver')
+ ->create($notepadID);
+ } catch (Mnemo_Exception $e) {
+ throw new Mnemo_Exception(sprintf(_("Connection failed: %s"), $e->getMessage()), 500);
+ }
+
+ return $storage->delete($parts[2]);
+ }
+
/**
* Returns an array of UIDs for all notes that the current user is
* authorized to see.
diff --git a/mnemo/package.xml b/mnemo/package.xml
index 336aafcca34..c1901dee7ec 100644
--- a/mnemo/package.xml
+++ b/mnemo/package.xml
@@ -27,8 +27,7 @@
ASL
-* [jan] Add put() method to API to support WebDAV PUT requests.
-* [jan] Add browse() method to API to support WebDAV access.
+* [jan] Add browse(), put(), and path_delete() methods to API to support WebDAV access.
@@ -1247,8 +1246,7 @@
2014-05-06
ASL
-* [jan] Add put() method to API to support WebDAV PUT requests.
-* [jan] Add browse() method to API to support WebDAV access.
+* [jan] Add browse(), put(), and path_delete() methods to API to support WebDAV access.