X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Flogger%2Fsql.php;h=73552c143528d68066203148bc843f34f1e2481c;hb=bb84330234c649fb0a8726e488fca012f5295ce4;hp=50e5de9a6e246bc64788ab85f4eedf0ba870efeb;hpb=fa8e7ea2613e611a9c532bb923727de352a53b2a;p=tt-rss.git diff --git a/classes/logger/sql.php b/classes/logger/sql.php old mode 100644 new mode 100755 index 50e5de9a..73552c14 --- a/classes/logger/sql.php +++ b/classes/logger/sql.php @@ -1,31 +1,26 @@ 117) { + // separate PDO connection object is used for logging + if (!$this->pdo) $this->pdo = Db::instance()->pdo_connect(); - $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)); + if ($this->pdo && get_schema_version() > 117) { - $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL"; + $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null; - $result = Db::get()->query( - "INSERT INTO ttrss_error_log + $sth = $this->pdo->prepare("INSERT INTO ttrss_error_log (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES - ($errno, '$errstr', '$file', '$line', '$context', $owner_uid, NOW())"); + (?, ?, ?, ?, ?, ?, NOW())"); + $sth->execute([$errno, $errstr, $file, $line, $context, $owner_uid]); - return Db::get()->affected_rows($result) != 0; + return $sth->rowCount(); } return false; } } -?>