mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Restore SQL debug output
apparently something changed with hasListeners()
This commit is contained in:
@@ -80,9 +80,10 @@ class Laravel
|
||||
|
||||
public static function enableQueryDebug()
|
||||
{
|
||||
static $sql_debug_enabled;
|
||||
$db = Eloquent::DB();
|
||||
|
||||
if ($db && !$db->getEventDispatcher()->hasListeners('Illuminate\Database\Events\QueryExecuted')) {
|
||||
if ($db && !$sql_debug_enabled) {
|
||||
$db->listen(function (QueryExecuted $query) {
|
||||
// collect bindings and make them a little more readable
|
||||
$bindings = collect($query->bindings)->map(function ($item) {
|
||||
@@ -99,6 +100,7 @@ class Laravel
|
||||
c_echo("SQL[%Y{$query->sql} %y$bindings%n {$query->time}ms] \n");
|
||||
}
|
||||
});
|
||||
$sql_debug_enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user