]> git.wh0rd.org - tt-rss.git/blame - classes/logger/sql.php
pngcrush.sh
[tt-rss.git] / classes / logger / sql.php
CommitLineData
889a5f9f
AD
1<?php
2class Logger_SQL {
3
bb843302
AD
4 private $pdo;
5
889a5f9f 6 function log_error($errno, $errstr, $file, $line, $context) {
aca75cb5 7
bb843302
AD
8 // separate PDO connection object is used for logging
9 if (!$this->pdo) $this->pdo = Db::instance()->pdo_connect();
10
11 if ($this->pdo && get_schema_version() > 117) {
c949a928 12
4102eb84 13 $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null;
889a5f9f 14
bb843302 15 $sth = $this->pdo->prepare("INSERT INTO ttrss_error_log
889a5f9f 16 (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
4102eb84
AD
17 (?, ?, ?, ?, ?, ?, NOW())");
18 $sth->execute([$errno, $errstr, $file, $line, $context, $owner_uid]);
889a5f9f 19
4102eb84 20 return $sth->rowCount();
889a5f9f 21 }
aca75cb5 22
889a5f9f
AD
23 return false;
24 }
25
bb843302 26}