From 7907803d71572fa5e6638e8ce52b6ec9d6ca2145 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 17 Nov 2009 20:23:48 +0000 Subject: [PATCH] Debug mails added --- .gitattributes | 1 + inc/functions.php | 30 ++++++++++++++++++- inc/language/de.php | 1 + .../de/emails/admin/admin_report_bug.tpl | 17 +++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 templates/de/emails/admin/admin_report_bug.tpl diff --git a/.gitattributes b/.gitattributes index 49162ca513..c82c2dd43d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -718,6 +718,7 @@ templates/de/emails/admin/admin_rallye_no_notify.tpl -text templates/de/emails/admin/admin_rallye_notify.tpl -text templates/de/emails/admin/admin_rallye_purged.tpl -text templates/de/emails/admin/admin_refback.tpl -text +templates/de/emails/admin/admin_report_bug.tpl -text templates/de/emails/admin/admin_reset_password.tpl -text templates/de/emails/admin/admin_sponsor_change_data.tpl -text templates/de/emails/admin/admin_sponsor_change_email.tpl -text diff --git a/inc/functions.php b/inc/functions.php index 3377256d43..3ee5bdff81 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2546,6 +2546,24 @@ function debug_get_printable_backtrace () { return $backtrace; } +// A mail-able backtrace +function debug_get_mailable_backtrace () { + // Init variable + $backtrace = ''; + + // Get and prepare backtrace for output + $backtraceArray = debug_backtrace(); + foreach ($backtraceArray as $key => $trace) { + if (!isset($trace['file'])) $trace['file'] = __FUNCTION__; + if (!isset($trace['line'])) $trace['line'] = __LINE__; + if (!isset($trace['args'])) $trace['args'] = array(); + $backtrace .= ($key+1) . '.:' . basename($trace['file']) . ':' . $trace['line'] . ', ' . $trace['function'] . '(' . count($trace['args']) . ")\n"; + } // END - foreach + + // Return the backtrace + return $backtrace; +} + // Output a debug backtrace to the user function debug_report_bug ($message = '') { // Is this already called? @@ -2574,11 +2592,21 @@ function debug_report_bug ($message = '') { } // END - if // Add output - $debug .= "Please report this bug at bugs.mxchange.org and include the logfile from " . str_replace(getConfig('PATH'), '', getConfig('CACHE_PATH')) . "debug.log in your report (you can now attach files):
";
+	$debug .= "Please report this bug at http://bugs.mxchange.org and include the logfile from " . str_replace(getConfig('PATH'), '', getConfig('CACHE_PATH')) . "debug.log in your report (you can now attach files):
";
 	$debug .= debug_get_printable_backtrace();
 	$debug .= "
\nRequest-URI: " . getRequestUri()."
\n"; $debug .= "Thank you for finding bugs."; + // Prepare content + $content = array( + 'message' => trim($message), + 'backtrace' => trim(debug_get_mailable_backtrace()), + 'request_uri' => trim(getRequestUri()) + ); + + // Send email to webmaster + sendAdminNotification(getMessage('DEBUG_REPORT_BUG_SUBJECT'), 'admin_report_bug', $content); + // And abort here // @TODO This cannot be rewritten to app_die(), try to find a solution for this. die($debug); diff --git a/inc/language/de.php b/inc/language/de.php index 570c3daa80..6cd559647f 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -1139,6 +1139,7 @@ addMessages(array( 'ADMIN_WARNING_SQL_PATCHES_MISSING' => "Eine essentielle Erweiterung sql_patches ist noch nicht installiert. Bitte erledigen Sie dies bald, da Ihr {?mt_word?} sonst nicht funktioniert.", 'ADMIN_EXTENSION_IS_NON_PRODUCTIVE' => "Die von Ihnen ausgewählte Erweiterung %s ist noch nicht für den produktiven Betrieb freigegeben und befindet sich somit noch in der Entwicklung. Bitte nur verwenden, wenn Sie wissen, was Sie tun.", 'ADMIN_ENTRIES_404' => "Es wurden keine Einträge gefunden.", + 'DEBUG_REPORT_BUG_SUBJECT' => "[BUG!] Es wurde ein Fehler im Script erkannt:", 'MEMBER_MAIL_BONUS_CONFIRMED_ON' => "Sie haben diese Bonusmail %s bestätigt.", 'MEMBER_MAIL_NORMAL_CONFIRMED_ON' => "Sie haben diese Klickmail %s bestätigt.", diff --git a/templates/de/emails/admin/admin_report_bug.tpl b/templates/de/emails/admin/admin_report_bug.tpl new file mode 100644 index 0000000000..3c27d94fe9 --- /dev/null +++ b/templates/de/emails/admin/admin_report_bug.tpl @@ -0,0 +1,17 @@ +Hallo Administrator, + +Es wurde soeben ein Fehler im Mailsystem erkannt. Hier ist der Fehlertext: + +------------------------------ +Fehlermeldung: $content[message] +------------------------------ +Backtrace: +$content[backtrace] +------------------------------ +Abfrage-String: $content[request_uri] +------------------------------ + +Mit freundlichen Grüßen, + Ihr {?MAIN_TITLE?} Script + +{?URL?}/admin.php -- 2.30.2