add feature to delete media of Charactergroupsquests (implements #6)
This commit is contained in:
parent
64a47dfc5f
commit
c6142fb5cf
6 changed files with 88 additions and 25 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue