diff options
Diffstat (limited to 'boot.php')
-rw-r--r-- | boot.php | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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); |