tt-rss/classes/logger/sql.php

32 lines
849 B
PHP
Raw Normal View History

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