]> git.mxchange.org Git - friendica.git/commitdiff
bring back the email and logging of update failures, but without the transactions
authorfriendica <info@friendica.com>
Sun, 29 Apr 2012 00:50:28 +0000 (17:50 -0700)
committerfriendica <info@friendica.com>
Sun, 29 Apr 2012 00:50:28 +0000 (17:50 -0700)
boot.php
view/en/update_fail_eml.tpl [new file with mode: 0644]
view/update_fail_eml.tpl [deleted file]

index 105180c23170a0f9b5c33cb95fd91c1ecef3c8be..7564615a5d4aa6ddf72e030415ee0870cc89516d 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -658,32 +658,26 @@ if(! function_exists('check_config')) {
 
                                                        // call the specific update
 
-//                                                     global $db;
-//                                                     $db->excep(TRUE);
-//                                                     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());
+                                                       $func = 'update_' . $x;
+                                                       $retval = $func($a);
+                                                       if($retval) {
+                                                               //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' => sprintf( t('Update %s failed. See error logs.'), $x)
+                                                               ));
+                                                               $subject=sprintf(t('Update Error at %s'), $a->get_baseurl());
                                                                        
-//                                                             mail($a->config['admin_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);
-//                                                     }
-//                                                     $db->excep(FALSE);
+                                                               mail($a->config['admin_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('CRITICAL: Update Failed: '. $x);
+                                                       }
                                                }
                                        }
                                        set_config('system','build', DB_UPDATE_VERSION);
diff --git a/view/en/update_fail_eml.tpl b/view/en/update_fail_eml.tpl
new file mode 100644 (file)
index 0000000..f68a3de
--- /dev/null
@@ -0,0 +1,11 @@
+Hey, \r
+I'm $sitename.   \r
+The friendica developers released update $update recently, \r
+but when I tried to install it, something went terribly wrong.  \r
+This needs to be fixed soon and I can't do it alone. Please contact a \r
+friendica developer if you can not help me on your own. My database might be invalid. \r
+\r
+The error message is '$error'.   \r
+\r
+I'm sorry, \r
+your friendica server at $siteurl
\ No newline at end of file
diff --git a/view/update_fail_eml.tpl b/view/update_fail_eml.tpl
deleted file mode 100644 (file)
index f68a3de..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-Hey, \r
-I'm $sitename.   \r
-The friendica developers released update $update recently, \r
-but when I tried to install it, something went terribly wrong.  \r
-This needs to be fixed soon and I can't do it alone. Please contact a \r
-friendica developer if you can not help me on your own. My database might be invalid. \r
-\r
-The error message is '$error'.   \r
-\r
-I'm sorry, \r
-your friendica server at $siteurl
\ No newline at end of file