aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorAlexander Kampmann <programmer@nurfuerspam.de>2012-04-09 00:45:10 +0200
committerAlexander Kampmann <programmer@nurfuerspam.de>2012-04-09 00:45:10 +0200
commit0d60dbef31ea645b8495d8e28fca6c248d20048b (patch)
treeab89e4c9de89b31973820402db4400cc10389ccb /boot.php
parent5c0446975516f2b52b6cf51618e0b75af56de71b (diff)
downloadvolse-hubzilla-0d60dbef31ea645b8495d8e28fca6c248d20048b.tar.gz
volse-hubzilla-0d60dbef31ea645b8495d8e28fca6c248d20048b.tar.bz2
volse-hubzilla-0d60dbef31ea645b8495d8e28fca6c248d20048b.zip
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
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/boot.php b/boot.php
index b1c378d34..c21cefa18 100644
--- a/boot.php
+++ b/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);