deletion of email now also deletes attachments of that email
This commit is contained in:
parent
6c28e6626b
commit
61a55423d2
|
@ -42,9 +42,14 @@ switch($action)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(unlink($dir.DS.$id.'.json'))
|
if(unlink($dir.DS.$id.'.json'))
|
||||||
|
{
|
||||||
|
$attachments = listAttachmentsOfMailID($email,$id);
|
||||||
|
foreach($attachments as $attachment)
|
||||||
|
unlink($dir.DS.'attachments'.DS.$attachment);
|
||||||
$o = array('status'=>'ok');
|
$o = array('status'=>'ok');
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$o = array('status'=>'err','reason'=>'Could not delete email');
|
$o = array('status'=>'err','reason'=>'Could not delete email. Permission problem?');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'getdoms':
|
case 'getdoms':
|
||||||
|
|
|
@ -65,6 +65,22 @@ function listEmailAdresses()
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function listAttachmentsOfMailID($email,$id)
|
||||||
|
{
|
||||||
|
$o = array();
|
||||||
|
if ($handle = opendir(getDirForEmail($email).DS.'attachments')) {
|
||||||
|
while (false !== ($entry = readdir($handle))) {
|
||||||
|
if (startsWith($entry,$id.'-')) {
|
||||||
|
$o[] = $entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadSettings()
|
function loadSettings()
|
||||||
{
|
{
|
||||||
if(file_exists(ROOT.DS.'..'.DS.'config.ini'))
|
if(file_exists(ROOT.DS.'..'.DS.'config.ini'))
|
||||||
|
|
Loading…
Reference in a new issue