X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Flogger%2Fsql.php;h=73552c143528d68066203148bc843f34f1e2481c;hb=bb84330234c649fb0a8726e488fca012f5295ce4;hp=b0e0b0db5e1f05eac78112931c14715ad5049052;hpb=aca75cb5cb323535099c7aef46a78ea3cec082f2;p=tt-rss.git diff --git a/classes/logger/sql.php b/classes/logger/sql.php old mode 100644 new mode 100755 index b0e0b0db..73552c14 --- a/classes/logger/sql.php +++ b/classes/logger/sql.php @@ -1,31 +1,26 @@ 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 = db_escape_string($this->link, 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; } } -?>