Debug mails added
authorRoland Häder <roland@mxchange.org>
Tue, 17 Nov 2009 20:23:48 +0000 (20:23 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 17 Nov 2009 20:23:48 +0000 (20:23 +0000)
.gitattributes
inc/functions.php
inc/language/de.php
templates/de/emails/admin/admin_report_bug.tpl [new file with mode: 0644]

index 49162ca5134775b6ef54355bba5d11d68dfb1853..c82c2dd43ddd12ea4b93b591c3b320714183f29f 100644 (file)
@@ -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
index 3377256d43afc0d8fc52306dd88656375b61d103..3ee5bdff81c5ef7e8ffa360d5047c56ca5987707 100644 (file)
@@ -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 <a title=\"Direct link to the bug-tracker\" href=\"http://bugs.mxchange.org\" rel=\"external\" target=\"_blank\">bugs.mxchange.org</a> and include the logfile from <strong>" . str_replace(getConfig('PATH'), '', getConfig('CACHE_PATH')) . "debug.log</strong> in your report (you can now attach files):<pre>";
+       $debug .= "Please report this bug at <a title=\"Direct link to the bug-tracker\" href=\"http://bugs.mxchange.org\" rel=\"external\" target=\"_blank\">http://bugs.mxchange.org</a> and include the logfile from <strong>" . str_replace(getConfig('PATH'), '', getConfig('CACHE_PATH')) . "debug.log</strong> in your report (you can now attach files):<pre>";
        $debug .= debug_get_printable_backtrace();
        $debug .= "</pre>\nRequest-URI: " . getRequestUri()."<br />\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);
index 570c3daa8005696c9654b9edd7bc38f5c590e842..6cd559647f54c620c5bb202ea3ce4edb9a1a84cd 100644 (file)
@@ -1139,6 +1139,7 @@ addMessages(array(
        'ADMIN_WARNING_SQL_PATCHES_MISSING' => "Eine essentielle Erweiterung <span=\"data\">sql_patches</span> 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&auml;hlte Erweiterung <span=\"data\">%s</span> ist noch nicht f&uuml;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&auml;ge gefunden.",
+       'DEBUG_REPORT_BUG_SUBJECT' => "[BUG!] Es wurde ein Fehler im Script erkannt:",
 
        'MEMBER_MAIL_BONUS_CONFIRMED_ON' => "Sie haben diese Bonusmail <span class=\"data\">%s</span> best&auml;tigt.",
        'MEMBER_MAIL_NORMAL_CONFIRMED_ON' => "Sie haben diese Klickmail <span class=\"data\">%s</span> best&auml;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 (file)
index 0000000..3c27d94
--- /dev/null
@@ -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&uuml;&szlig;en,
+  Ihr {?MAIN_TITLE?} Script
+
+{?URL?}/admin.php