X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=classes%2Flogger%2Fsql.php;h=73552c143528d68066203148bc843f34f1e2481c;hb=bb84330234c649fb0a8726e488fca012f5295ce4;hp=96263a97e7f97245f1835845d1d17fa6464e637c;hpb=b8619f8db01c10500814171631c83da3f770ea03;p=tt-rss.git diff --git a/classes/logger/sql.php b/classes/logger/sql.php old mode 100644 new mode 100755 index 96263a97..73552c14 --- a/classes/logger/sql.php +++ b/classes/logger/sql.php @@ -1,27 +1,26 @@ 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 = DB::get()->escape_string($context); + // separate PDO connection object is used for logging + if (!$this->pdo) $this->pdo = Db::instance()->pdo_connect(); + + 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; } } -?>