sql.php 584 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. class Logger_SQL {
  3. function log_error($errno, $errstr, $file, $line, $context) {
  4. $pdo = Db::pdo();
  5. if ($pdo && get_schema_version() > 117) {
  6. try {
  7. $pdo->rollBack();
  8. } catch (Exception $e) {
  9. //
  10. }
  11. $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : null;
  12. $sth = $pdo->prepare("INSERT INTO ttrss_error_log
  13. (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
  14. (?, ?, ?, ?, ?, ?, NOW())");
  15. $sth->execute([$errno, $errstr, $file, $line, $context, $owner_uid]);
  16. return $sth->rowCount();
  17. }
  18. return false;
  19. }
  20. }