diff options
Diffstat (limited to 'inc/eventlog.inc.php')
-rw-r--r-- | inc/eventlog.inc.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/inc/eventlog.inc.php b/inc/eventlog.inc.php index 836b6974..6683986c 100644 --- a/inc/eventlog.inc.php +++ b/inc/eventlog.inc.php @@ -1,10 +1,22 @@ <?php +/** + * Class to add entries to the event log. Technically this class belongs to the + * eventlog module, but since it is used in so many places, this helper resides + * in the general inc directory instead of the eventlog's inc directory, since + * that would require to add "if (Module::isAvailable('eventlog')) { ... }" + * all over the place. Instead, the availability check was moved here. + */ class EventLog { private static function log($type, $message, $details) { + if (!Module::isAvailable('eventlog')) { + // Eventlog module does not exist; the eventlog table might not exist, so bail out + error_log($message); + return; + } Database::exec("INSERT INTO eventlog (dateline, logtypeid, description, extra)" . " VALUES (UNIX_TIMESTAMP(), :type, :message, :details)", array( 'type' => $type, @@ -35,6 +47,8 @@ class EventLog */ public static function clear() { + if (!Module::isAvailable('eventlog')) + return; Database::exec("TRUNCATE eventlog"); } |