questtype ?Submit?: use database transaction for adding terms
This commit is contained in:
parent
f4980652c2
commit
794462e3e9
|
@ -281,6 +281,8 @@
|
|||
*/
|
||||
private function addTerms($submissionId, $terms)
|
||||
{
|
||||
$this->db->setAutocommit(false);
|
||||
try {
|
||||
// Calculate IDF: n (n_term)
|
||||
$uniqueTerms = array();
|
||||
foreach($terms as &$term)
|
||||
|
@ -314,6 +316,14 @@
|
|||
);
|
||||
}
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
$this->db->rollback();
|
||||
$this->db->setAutocommit(true);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$this->db->setAutocommit(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue