| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
/** |
| 6 |
* Enable Query Log |
| 7 |
*/ |
| 8 |
if (!function_exists('fluentbooking_eql')) { |
| 9 |
function fluentbooking_eql() |
| 10 |
{ |
| 11 |
defined('SAVEQUERIES') || define('SAVEQUERIES', true); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound |
| 12 |
} |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Get Query Log |
| 17 |
*/ |
| 18 |
if (!function_exists('fluentbooking_gql')) { |
| 19 |
function fluentbooking_gql() |
| 20 |
{ |
| 21 |
$result = []; |
| 22 |
foreach ((array)$GLOBALS['wpdb']->queries as $key => $query) { |
| 23 |
$result[++$key] = array_combine([ |
| 24 |
'query', 'execution_time' |
| 25 |
], array_slice($query, 0, 2)); |
| 26 |
} |
| 27 |
return $result; |
| 28 |
} |
| 29 |
} |
| 30 |
|
| 31 |
|