]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | class Logger_SQL { | |
3 | ||
4 | private $pdo; | |
5 | ||
6 | function log_error($errno, $errstr, $file, $line, $context) { | |
7 | ||
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) { | |
12 | ||
13 | $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null; | |
14 | ||
15 | $sth = $this->pdo->prepare("INSERT INTO ttrss_error_log | |
16 | (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES | |
17 | (?, ?, ?, ?, ?, ?, NOW())"); | |
18 | $sth->execute([$errno, $errstr, $file, $line, $context, $owner_uid]); | |
19 | ||
20 | return $sth->rowCount(); | |
21 | } | |
22 | ||
23 | return false; | |
24 | } | |
25 | ||
26 | } |