2013-04-16 15:41:31 +00:00
|
|
|
<?php
|
|
|
|
class Logger_SQL {
|
|
|
|
|
|
|
|
function log_error($errno, $errstr, $file, $line, $context) {
|
|
|
|
|
|
|
|
if ($errno == E_NOTICE) return false;
|
|
|
|
|
2013-04-17 09:08:36 +00:00
|
|
|
if (Db::get()) {
|
2013-04-17 12:05:52 +00:00
|
|
|
|
2013-04-17 09:08:36 +00:00
|
|
|
$errno = Db::get()->escape_string($errno);
|
|
|
|
$errstr = Db::get()->escape_string($errstr);
|
|
|
|
$file = Db::get()->escape_string($file);
|
|
|
|
$line = Db::get()->escape_string($line);
|
2013-04-16 16:16:15 +00:00
|
|
|
$context = ''; // backtrace is a lot of data which is not really critical to store
|
2013-04-17 16:12:14 +00:00
|
|
|
//$context = $this->dbh->escape_string(serialize($context));
|
2013-04-16 15:41:31 +00:00
|
|
|
|
|
|
|
$owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL";
|
|
|
|
|
2013-04-17 09:08:36 +00:00
|
|
|
$result = Db::get()->query(
|
2013-04-16 15:41:31 +00:00
|
|
|
"INSERT INTO ttrss_error_log
|
|
|
|
(errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
|
|
|
|
($errno, '$errstr', '$file', '$line', '$context', $owner_uid, NOW())");
|
|
|
|
|
2013-04-17 09:08:36 +00:00
|
|
|
return Db::get()->affected_rows($result) != 0;
|
2013-04-16 15:41:31 +00:00
|
|
|
}
|
2013-04-17 12:05:52 +00:00
|
|
|
|
2013-04-16 15:41:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|