let database class handle transactions, index.php need not know about database->db

This commit is contained in:
Shish 2012-06-24 00:27:53 +01:00
parent dd505e556e
commit 98e7acc529

View file

@ -75,7 +75,6 @@ try {
ctx_log_start("Connecting to DB"); ctx_log_start("Connecting to DB");
// connect to the database // connect to the database
$database = new Database(); $database = new Database();
$database->db->beginTransaction();
$config = new DatabaseConfig($database); $config = new DatabaseConfig($database);
ctx_log_endok(); ctx_log_endok();
@ -102,11 +101,11 @@ try {
// saving cache data and profiling data to disk can happen later // saving cache data and profiling data to disk can happen later
if(function_exists("fastcgi_finish_request")) fastcgi_finish_request(); if(function_exists("fastcgi_finish_request")) fastcgi_finish_request();
$database->db->commit(); $database->commit();
ctx_log_endok(); ctx_log_endok();
} }
catch(Exception $e) { catch(Exception $e) {
if($database && $database->db) $database->db->rollback(); if($database) $database->rollback();
_fatal_error($e); _fatal_error($e);
ctx_log_ender(); ctx_log_ender();
} }