diff options
author | Adrian Lang <dokuwiki@adrianlang.de> | 2011-02-06 12:51:09 +0100 |
---|---|---|
committer | Adrian Lang <dokuwiki@adrianlang.de> | 2011-02-06 12:55:53 +0100 |
commit | 87229c84afbda98679146558235bc7212ea404ee (patch) | |
tree | 737e207675c475ce8b1ab118a5e8f399d99be716 /lib/exe/xmlrpc.php | |
parent | 2343a762fb62ebed6ef140bca2d8b5aa4fa2983d (diff) | |
download | rpg-87229c84afbda98679146558235bc7212ea404ee.tar.gz rpg-87229c84afbda98679146558235bc7212ea404ee.tar.bz2 |
XML-RPC deleteAttachment now uses media_delete
Functionality changes:
* deleteAttachment now triggers MEDIA_DELETE_FILE (closes FS#1568)
* deletion success msg in mediamanager is correct, even when the ns dir
was deleted
* media_delete changed quite a bit
Diffstat (limited to 'lib/exe/xmlrpc.php')
-rw-r--r-- | lib/exe/xmlrpc.php | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php index d40e338b2..945dc3f67 100644 --- a/lib/exe/xmlrpc.php +++ b/lib/exe/xmlrpc.php @@ -674,27 +674,15 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer { function deleteAttachment($id){ $id = cleanID($id); $auth = auth_quickaclcheck(getNS($id).':*'); - if($auth < AUTH_DELETE) return new IXR_ERROR(1, "You don't have permissions to delete files."); - global $conf; - global $lang; - - // check for references if needed - $mediareferences = array(); - if($conf['refcheck']){ - $mediareferences = ft_mediause($id,$conf['refshow']); - } - - if(!count($mediareferences)){ - $file = mediaFN($id); - if(@unlink($file)){ - addMediaLogEntry(time(), $id, DOKU_CHANGE_TYPE_DELETE); - io_sweepNS($id,'mediadir'); - return 0; - } - //something went wrong - return new IXR_ERROR(1, 'Could not delete file'); - } else { + $res = media_delete($id, $auth); + if ($res & DOKU_MEDIA_DELETED) { + return 0; + } elseif ($res & DOKU_MEDIA_NOT_AUTH) { + return new IXR_ERROR(1, "You don't have permissions to delete files."); + } elseif ($res & DOKU_MEDIA_INUSE) { return new IXR_ERROR(1, 'File is still referenced'); + } else { + return new IXR_ERROR(1, 'Could not delete file'); } } |