SOURCES: eventum-errorhandler.patch - some vars not avail from cli

glen glen at pld-linux.org
Thu Mar 15 18:37:36 CET 2007


Author: glen                         Date: Thu Mar 15 17:37:36 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- some vars not avail from cli

---- Files affected:
SOURCES:
   eventum-errorhandler.patch (1.4 -> 1.5) 

---- Diffs:

================================================================
Index: SOURCES/eventum-errorhandler.patch
diff -u SOURCES/eventum-errorhandler.patch:1.4 SOURCES/eventum-errorhandler.patch:1.5
--- SOURCES/eventum-errorhandler.patch:1.4	Thu Mar 15 18:14:51 2007
+++ SOURCES/eventum-errorhandler.patch	Thu Mar 15 18:37:30 2007
@@ -15,8 +15,8 @@
              return $res;
          } else {
              return true;
---- include/class.error_handler.php	(working copy)
-+++ include/class.error_handler.php	2007-03-14 00:15:44.804500919 +0200
+--- include/class.error_handler.php	2007-03-14 00:15:44.804500919 +0200
++++ include/class.error_handler.php	2007-03-15 19:22:20.000000000 +0200
 @@ -32,8 +32,6 @@
  require_once(APP_INC_PATH . "class.mail.php");
  require_once(APP_INC_PATH . "class.setup.php");
@@ -26,7 +26,7 @@
  /**
   * Class to manage all tasks related to error conditions of the site, such as
   * logging facilities or alert notifications to the site administrators.
-@@ -45,126 +43,167 @@
+@@ -45,126 +43,171 @@
  class Error_Handler
  {
      /**
@@ -104,26 +104,18 @@
 -            $msg .= "'" . $error_msg[0] . "'\n\n";
 -            $msg .= "A more detailed error message follows:\n\n";
 -            $msg .= "'" . $error_msg[1] . "'\n\n";
+-        } else {
+-            $msg .= "'$error_msg'\n\n";
 +        $msg .= $notify_msg;
-+        $msg .= "That happened on page '" . $_SERVER['SCRIPT_NAME'] . "' from IP Address '" . $_SERVER['REMOTE_ADDR'] . "' coming from the page (referrer) '" . $_SERVER['HTTP_REFERER'] . "'.\n\n";
-+        $msg .= "The user agent given was '" . $_SERVER['HTTP_USER_AGENT'] . "'.\n\n";
-+        $msg .= "-- \nSincerely yours,\nAutomated Error_Handler Class";
 +
-+        // query database for 'max_allowed_packet'
-+        $stmt = "show variables like 'max_allowed_packet'";
-+        $res =& $GLOBALS['db_api']->dbh->query($stmt);
-+        if (PEAR::isError($res)) {
-+            // we failed, assume 8M
-+            $max_allowed_packet = 8387584;
-         } else {
--            $msg .= "'$error_msg'\n\n";
-+            $arr = $res->fetchRow(DB_FETCHMODE_ORDERED);
-+            $max_allowed_packet = $arr[1];
-+            $res->free();
++        // this checks that we're not running from commandline (cron for example)
++        if (isset($_SERVER['REMOTE_ADDR'])) {
++            $msg .= "That happened on page '" . $_SERVER['SCRIPT_NAME'] . "' from IP Address '" . $_SERVER['REMOTE_ADDR'] . "' coming from the page (referrer) '" . $_SERVER['HTTP_REFERER'] . "'.\n\n";
++            $msg .= "The user agent given was '" . $_SERVER['HTTP_USER_AGENT'] . "'.\n\n";
          }
 -        @$msg .= "That happened on page '" . $_SERVER["PHP_SELF"] . "' from IP Address '" . $_SERVER['REMOTE_ADDR'] . "' coming from the page (referrer) '" . $_SERVER['HTTP_REFERER'] . "'.\n\n";
 -        @$msg .= "The user agent given was '" . $_SERVER['HTTP_USER_AGENT'] . "'.\n\n";
--        $msg .= "-- \nSincerely yours,\nAutomated Error_Handler Class";
+         $msg .= "-- \nSincerely yours,\nAutomated Error_Handler Class";
 -        // only try to include the backtrace if we are on PHP 4.3.0 or later
 -        if (version_compare(phpversion(), "4.3.0", ">=")) {
 -            $msg .= "\n\nA backtrace is available:\n\n";
@@ -142,6 +134,18 @@
 -        // was bigger than max_allowed_packet (usually 16 megs on 3.23
 -        // client libraries)
 -        if (strlen($msg) > 16777216) {
++
++        // query database for 'max_allowed_packet'
++        $stmt = "show variables like 'max_allowed_packet'";
++        $res =& $GLOBALS['db_api']->dbh->query($stmt);
++        if (PEAR::isError($res)) {
++            // we failed, assume 8M
++            $max_allowed_packet = 8387584;
++        } else {
++            $arr = $res->fetchRow(DB_FETCHMODE_ORDERED);
++            $max_allowed_packet = $arr[1];
++            $res->free();
++        }
 +
 +        // skip error details of an email notification about a query that
 +        // was bigger than max_allowed_packet + 1024
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/eventum-errorhandler.patch?r1=1.4&r2=1.5&f=u



More information about the pld-cvs-commit mailing list