1
0
mirror of https://tt-rss.org/git/tt-rss.git synced 2024-06-29 12:20:51 +02:00
ttrss/classes/logger/sql.php
2013-04-19 09:45:43 +04:00

29 lines
833 B
PHP

<?php
class Logger_SQL {
function log_error($errno, $errstr, $file, $line, $context) {
if (Db::get() && get_schema_version() > 117) {
$errno = Db::get()->escape_string($errno);
$errstr = Db::get()->escape_string($errstr);
$file = Db::get()->escape_string($file);
$line = Db::get()->escape_string($line);
$context = ''; // backtrace is a lot of data which is not really critical to store
//$context = $this->dbh->escape_string(serialize($context));
$owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL";
$result = Db::get()->query(
"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;
}
return false;
}
}
?>