sql.php 636 B

1234567891011121314151617181920212223242526
  1. <?php
  2. class Logger_SQL {
  3. private $pdo;
  4. function log_error($errno, $errstr, $file, $line, $context) {
  5. // separate PDO connection object is used for logging
  6. if (!$this->pdo) $this->pdo = Db::instance()->pdo_connect();
  7. if ($this->pdo && get_schema_version() > 117) {
  8. $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null;
  9. $sth = $this->pdo->prepare("INSERT INTO ttrss_error_log
  10. (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
  11. (?, ?, ?, ?, ?, ?, NOW())");
  12. $sth->execute([$errno, $errstr, $file, $line, $context, $owner_uid]);
  13. return $sth->rowCount();
  14. }
  15. return false;
  16. }
  17. }