%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64 User : addictionfreeind ( 1003) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system Directory : /home/addictionfreeind/www/vendor/cakephp/debug_kit/config/ |
Upload File : |
<?php
/**
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Configure;
use Cake\Core\Plugin;
use Cake\Datasource\ConnectionManager;
use Cake\Event\EventManager;
use Cake\Log\Log;
use Cake\ORM\Query;
use Cake\Routing\DispatcherFactory;
use DebugKit\DebugSql;
use DebugKit\Middleware\DebugKitMiddleware;
use DebugKit\Routing\Filter\DebugBarFilter;
use DebugKit\ToolbarService;
$service = new ToolbarService(EventManager::instance(), (array)Configure::read('DebugKit'));
if (!$service->isEnabled() || php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg') {
return;
}
$hasDebugKitConfig = ConnectionManager::getConfig('debug_kit');
if (!$hasDebugKitConfig && !in_array('sqlite', PDO::getAvailableDrivers())) {
$msg = 'DebugKit not enabled. You need to either install pdo_sqlite, ' .
'or define the "debug_kit" connection name.';
Log::warning($msg);
return;
}
if (!$hasDebugKitConfig) {
ConnectionManager::setConfig('debug_kit', [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Sqlite',
'database' => TMP . 'debug_kit.sqlite',
'encoding' => 'utf8',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
]);
}
if (Plugin::routes('DebugKit') === false) {
require __DIR__ . DS . 'routes.php';
}
$appClass = Configure::read('App.namespace') . '\Application';
if (class_exists($appClass)) {
EventManager::instance()->on('Server.buildMiddleware', function ($event, $queue) use ($service) {
$middleware = new DebugKitMiddleware($service);
$queue->insertAt(0, $middleware);
});
} else {
// Setup dispatch filter
$debugBar = new DebugBarFilter(EventManager::instance(), (array)Configure::read('DebugKit'));
$debugBar->setup();
DispatcherFactory::add($debugBar);
}
if (!function_exists('sql')) {
/**
* Prints out the SQL statements generated by a Query object.
*
* This function returns the same variable that was passed.
* Only runs if debug mode is enabled.
*
* @param Query $query Query to show SQL statements for.
* @param bool $showValues Renders the SQL statement with bound variables.
* @param bool|null $showHtml If set to true, the method prints the debug
* data in a browser-friendly way.
* @return Query
*/
function sql(Query $query, $showValues = true, $showHtml = null)
{
return DebugSql::sql($query, $showValues, $showHtml, 1);
}
}
if (!function_exists('sqld')) {
/**
* Prints out the SQL statements generated by a Query object and dies.
*
* Only runs if debug mode is enabled.
* It will otherwise just continue code execution and ignore this function.
*
* @param Query $query Query to show SQL statements for.
* @param bool $showValues Renders the SQL statement with bound variables.
* @param bool|null $showHtml If set to true, the method prints the debug
* data in a browser-friendly way.
* @return void
*/
function sqld(Query $query, $showValues = true, $showHtml = null)
{
DebugSql::sqld($query, $showValues, $showHtml, 2);
}
}