added exceptions to dba class
added exception handling to index.php, please mind that there is no recovery at the moment added transactions to db update. Please mind that they might not be supported by db table engines. added admin email on failed updates added german translation for admin email
This commit is contained in:
23
boot.php
23
boot.php
@@ -653,8 +653,31 @@ function check_config(&$a) {
|
||||
|
||||
// call the specific update
|
||||
|
||||
global $db;
|
||||
try {
|
||||
$db->beginTransaction();
|
||||
$func = 'update_' . $x;
|
||||
$func($a);
|
||||
$db->commit();
|
||||
} catch(Exception $ex) {
|
||||
$db->rollback();
|
||||
//send the administrator an e-mail
|
||||
$email_tpl = get_intltext_template("update_fail_eml.tpl");
|
||||
$email_tpl = replace_macros($email_tpl, array(
|
||||
'$sitename' => $a->config['sitename'],
|
||||
'$siteurl' => $a->get_baseurl(),
|
||||
'$update' => $x,
|
||||
'$error' => $ex->getMessage());
|
||||
$subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
|
||||
|
||||
mail($email, $subject, $text,
|
||||
'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
|
||||
. 'Content-type: text/plain; charset=UTF-8' . "\n"
|
||||
. 'Content-transfer-encoding: 8bit' );
|
||||
//try the logger
|
||||
logger('update failed: '.$ex->getMessage().EOL);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
set_config('system','build', DB_UPDATE_VERSION);
|
||||
|
||||
Reference in New Issue
Block a user