]> git.wh0rd.org - tt-rss.git/blob - classes/logger/sql.php
Merge branch 'master' of git://github.com/falu/Tiny-Tiny-RSS into falu-master
[tt-rss.git] / classes / logger / sql.php
1 <?php
2 class Logger_SQL {
3
4 function log_error($errno, $errstr, $file, $line, $context) {
5 if (Db::get() && get_schema_version() > 117) {
6
7 $errno = Db::get()->escape_string($errno);
8 $errstr = Db::get()->escape_string($errstr);
9 $file = Db::get()->escape_string($file);
10 $line = Db::get()->escape_string($line);
11 $context = ''; // backtrace is a lot of data which is not really critical to store
12 //$context = $this->dbh->escape_string(serialize($context));
13
14 $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL";
15
16 $result = Db::get()->query(
17 "INSERT INTO ttrss_error_log
18 (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
19 ($errno, '$errstr', '$file', '$line', '$context', $owner_uid, NOW())");
20
21 return Db::get()->affected_rows($result) != 0;
22 }
23
24 return false;
25 }
26
27 }
28 ?>