
Public Member Functions | |
| PHPerror ($errno, $errstr, $errfile, $errline, $errcontext) | |
| recordError ($smessage, $errorkey, $lmessage='', $exception=null) | |
Static Public Member Functions | |
| static | getInstance ($request=null) |
Protected Attributes | |
| $DBclass = 'aliroCoreDatabase' | |
| $tableName = '#__error_log' | |
| $rowKey = 'id' | |
Static Protected Attributes | |
| static | $instance = null |
Definition at line 45 of file aliroErrorRecorder.php.
| static aliroErrorRecorder::getInstance | ( | $ | request = null |
) | [static] |
Definition at line 51 of file aliroErrorRecorder.php.
Referenced by aliroExtensionInstaller::doPackageCode(), aliroExtensionInstaller::install(), aliroAbstractRequest::invokeComponent(), aliroLanguageBasic::load(), and aliro::startup().
00051 { 00052 if (null == self::$instance) self::$instance = new aliroErrorRecorder(); 00053 return self::$instance; 00054 }
| aliroErrorRecorder::PHPerror | ( | $ | errno, | |
| $ | errstr, | |||
| $ | errfile, | |||
| $ | errline, | |||
| $ | errcontext | |||
| ) |
Definition at line 56 of file aliroErrorRecorder.php.
References aliroRequest::getInstance(), recordError(), and T_().
00056 { 00057 if (!($errno & error_reporting())) return; 00058 $rawmessage = function_exists('T_') ? T_('PHP Error %s: %s in %s at line %s') : 'PHP Error %s: %s in %s at line %s'; 00059 $message = sprintf($rawmessage, $errno, $errstr, $errfile, $errline); 00060 $lmessage = $message; 00061 if (is_array($errcontext)) { 00062 foreach ($errcontext as $key=>$value) if (!is_object($value) AND !(is_array($value))) $lmessage .= "; $key=$value"; 00063 } 00064 $errorkey = "PHP/$errno/$errfile/$errline/$errstr"; 00065 $this->recordError($message, $errorkey, $lmessage); 00066 aliroRequest::getInstance()->setErrorMessage(T_('A PHP error has been recorded in the log'), _ALIRO_ERROR_WARN); 00067 if ($errno & (E_USER_ERROR|E_COMPILE_ERROR|E_CORE_ERROR|E_ERROR)) die (T_('Serious PHP error - processing halted - see error log for details')); 00068 }
| aliroErrorRecorder::recordError | ( | $ | smessage, | |
| $ | errorkey, | |||
| $ | lmessage = '', |
|||
| $ | exception = null | |||
| ) |
Definition at line 70 of file aliroErrorRecorder.php.
References aliroCoreDatabase::getInstance(), aliroDBGeneralRow::store(), timestamp, and aliroRequest::trace().
Referenced by PHPerror().
00070 { 00071 $this->id = 0; 00072 $this->timestamp = date ('Y-m-d H:i:s'); 00073 $this->smessage = $smessage; 00074 $this->lmessage = $lmessage ? $lmessage : $smessage; 00075 $this->referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; 00076 $database = aliroCoreDatabase::getInstance(); 00077 $this->errorkey = $database->getEscaped($errorkey); 00078 $this->get = $_SERVER['REQUEST_URI']; 00079 $this->post = base64_encode(serialize($_POST)); 00080 $this->trace = aliroRequest::trace(); 00081 if ($exception instanceof databaseException) { 00082 $this->dbname = $exception->dbname; 00083 $this->sql = $exception->sql; 00084 $this->dberror = $exception->getCode(); 00085 $this->dbmessage = $exception->getMessage(); 00086 $this->dbtrace = $exception->dbtrace; 00087 } 00088 else $this->dbname = $this->sql = $this->dberror = $this->dbmessage = null; 00089 $database->setQuery("SELECT id FROM #__error_log WHERE errorkey = '$this->errorkey'"); 00090 $id = $database->loadResult(); 00091 if (!$id) $this->store(); 00092 else $database->doSQL("UPDATE #__error_log SET timestamp = NOW() WHERE id = $id"); 00093 // code to prune error log - limit to max items, max days 00094 $database = call_user_func(array($this->DBclass, 'getInstance')); 00095 $database->doSQL("DELETE LOW_PRIORITY FROM $this->tableName WHERE timestamp < SUBDATE(NOW(), INTERVAL 7 DAY)"); 00096 }
aliroErrorRecorder::$instance = null [static, protected] |
Definition at line 46 of file aliroErrorRecorder.php.
aliroErrorRecorder::$DBclass = 'aliroCoreDatabase' [protected] |
Definition at line 47 of file aliroErrorRecorder.php.
aliroErrorRecorder::$tableName = '#__error_log' [protected] |
Definition at line 48 of file aliroErrorRecorder.php.
aliroErrorRecorder::$rowKey = 'id' [protected] |
Definition at line 49 of file aliroErrorRecorder.php.
1.5.5