]> git.wh0rd.org - tt-rss.git/blame - classes/logger/sql.php
OPML: use PDO; minor fixes
[tt-rss.git] / classes / logger / sql.php
CommitLineData
889a5f9f
AD
1<?php
2class Logger_SQL {
3
889a5f9f 4 function log_error($errno, $errstr, $file, $line, $context) {
4102eb84
AD
5
6 $pdo = Db::pdo();
7
8 if ($pdo && get_schema_version() > 117) {
aca75cb5 9
c949a928
AD
10 try {
11 $pdo->rollBack();
12 } catch (Exception $e) {
13 //
14 }
15
4102eb84 16 $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null;
889a5f9f 17
4102eb84 18 $sth = $pdo->prepare("INSERT INTO ttrss_error_log
889a5f9f 19 (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
4102eb84
AD
20 (?, ?, ?, ?, ?, ?, NOW())");
21 $sth->execute([$errno, $errstr, $file, $line, $context, $owner_uid]);
889a5f9f 22
4102eb84 23 return $sth->rowCount();
889a5f9f 24 }
aca75cb5 25
889a5f9f
AD
26 return false;
27 }
28
ea79a0e0 29}