Commit 318d84e6 authored by Dries's avatar Dries
Browse files

- extended and renamed drop's watchdog.

parent 11ee95da
......@@ -5,12 +5,12 @@ function watchdog($level, $message) {
global $user;
### Perform query to add new log entry:
db_query("INSERT INTO logs (level, timestamp, user, message, hostname) VALUES ($level, '". time() ."', '". addslashes($user->id) ."', '". addslashes($message) ."', '". getenv("REMOTE_ADDR") ."')");
db_query("INSERT INTO watchdog (level, timestamp, user, message, location, hostname) VALUES ($level, '". time() ."', '". addslashes($user->id) ."', '". addslashes($message) ."', '". getenv("SCRIPT_NAME") ."', '". getenv("REMOTE_ADDR") ."')");
### Periodically remove old log entries:
if (time() % 20 == 0) {
$timestamp = time() - 1209600; // 2 weeks
db_query("DELETE FROM logs WHERE timestamp < $timestamp");
db_query("DELETE FROM watchdog WHERE timestamp < $timestamp");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment