sql.php 833 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. class Logger_SQL {
  3. function log_error($errno, $errstr, $file, $line, $context) {
  4. if (Db::get() && get_schema_version() > 117) {
  5. $errno = Db::get()->escape_string($errno);
  6. $errstr = Db::get()->escape_string($errstr);
  7. $file = Db::get()->escape_string($file);
  8. $line = Db::get()->escape_string($line);
  9. $context = ''; // backtrace is a lot of data which is not really critical to store
  10. //$context = $this->dbh->escape_string(serialize($context));
  11. $owner_uid = $_SESSION["uid"] ? $_SESSION["uid"] : "NULL";
  12. $result = Db::get()->query(
  13. "INSERT INTO ttrss_error_log
  14. (errno, errstr, filename, lineno, context, owner_uid, created_at) VALUES
  15. ($errno, '$errstr', '$file', '$line', '$context', $owner_uid, NOW())");
  16. return Db::get()->affected_rows($result) != 0;
  17. }
  18. return false;
  19. }
  20. }
  21. ?>