add feature to delete media of Charactergroupsquests (implements #6)

This commit is contained in:
oliver 2015-04-08 15:57:43 +02:00
commit c6142fb5cf
6 changed files with 88 additions and 25 deletions

View file

@ -135,6 +135,40 @@
return $data[0];
}
/**
* Delete a Seminary upload.
*
* @param int $uploadId ID of Seminary upload to delete
*/
public function deleteSeminaryupload($uploadId)
{
$this->db->setAutocommit(false);
try {
// Get Upload
$upload = $this->getSeminaryuploadById($uploadId);
// Delete database record
$this->db->query(
'DELETE FROM seminaryuploads '.
'WHERE id = ?',
'i',
$uploadId
);
// Delete file
$filename = ROOT.DS.\nre\configs\AppConfig::$dirs['seminaryuploads'].DS.$upload['url'];
unlink($filename);
}
catch(\nre\exceptions\DatamodelException $e) {
$this->db->rollback();
$this->db->setAutocommit(true);
}
$this->db->setAutocommit(true);
}
}