Commit 9a48de59 authored by Nigel McNie's avatar Nigel McNie
Browse files

Prevent artefact commits while Mahara is in the middle of crashing.

This is the #1 cause of Fatal Errors in Mahara - when a second exception (usually an SQLException) is thrown while we're in the middle of handling one already.

Now the first exception gets to follow through to its conclusion, which results in far better error messages.
parent 52cb10e6
......@@ -313,7 +313,7 @@ abstract class ArtefactType {
return;
}
if (!empty($this->dirty)) {
if (!empty($this->dirty) && !defined('MAHARA_CRASHING')) {
$this->commit();
}
}
......
......@@ -423,6 +423,13 @@ class MaharaException extends Exception {
protected $log = true;
public function __construct($message, $code=0) {
parent::__construct($message, $code);
if (!defined('MAHARA_CRASHING')) {
define('MAHARA_CRASHING', true);
}
}
public function get_string() {
$args = func_get_args();
if (function_exists('get_string')) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment