From aaebea471698aed861f35dee33bdc1e21e27f1aa Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sat, 1 Aug 2015 11:15:17 +1000 Subject: [PATCH] Tidy up the DB Event logger, add failsafe If there is a problem with the Model, don't try to log with a broken model (infinite loop), this can be confirmed by checking if the Model class alias exists --- modules/system/ServiceProvider.php | 3 +-- modules/system/models/EventLog.php | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/system/ServiceProvider.php b/modules/system/ServiceProvider.php index e6b81dfe0..d4b3466d5 100644 --- a/modules/system/ServiceProvider.php +++ b/modules/system/ServiceProvider.php @@ -6,7 +6,6 @@ use Event; use Config; use Backend; use Request; -use DbDongle; use Validator; use BackendMenu; use BackendAuth; @@ -244,7 +243,7 @@ class ServiceProvider extends ModuleServiceProvider protected function registerLogging() { Event::listen('illuminate.log', function ($level, $message, $context) { - if (DbDongle::hasDatabase() && !defined('OCTOBER_NO_EVENT_LOGGING')) { + if (EventLog::useLogging()) { EventLog::add($message, $level); } }); diff --git a/modules/system/models/EventLog.php b/modules/system/models/EventLog.php index a8d34157c..fc3e3aa9e 100644 --- a/modules/system/models/EventLog.php +++ b/modules/system/models/EventLog.php @@ -1,7 +1,8 @@