Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Debugbar | by kevdev

kevdev ☆☆☆☆☆ 0 reviews 73 завантажень 2,971 11/04/2023

Що можна обрати замість

Роблять те саме — можна поставити замість.
Opencart Profiler Vqmod
Простой Profiler для отладки магазинов. Добавляет после футера лог с полезной информацией. Отображает время загрузки страницы и общее количество запросов. А также подробную статистику, время выполнения и контроллер по каждому sql - запросу. Очень полезно для выявления узких мест. Для Opencart 1.5.6.x - отдельная версия. ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОР НЕ НЕСЕТ ОТВЕТСТВЕННОСТИ ПО ПРЕТЕНЗИЯМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ЭТИМ ДОПОЛНЕНИЕМ...

Updated

Opencart Profiler Vqmod

Free
Переглянути
1.0.0 Ioncube Loader: Ні
Sales paused Продаж призупинено адміністрацією форуму.
OpenCart3.0
ocStore3.0
License type Доменов не ограничено
Activation method Без активации
Ioncube LoaderНі
Get request to server of developerНі
Downloads73
Submitted11/30/2023
Updated11/04/2023
File Size12.38 kB

User Feedback

  

Невеликий інструмент який допоможе Вам дебажити ваш сайт.
Основні переваги:

  1. Легкий
  2. Відносно простий у встановленні
  3. Вносить зміни лише у 3 файли (header.php, loader.php, db.php)
  4. Дуже інформативний
  5. Працює лише при наявності активної сессії адміна
  6. Можливість переключатись між 10 останніми запитами

Недоліки:

  1. Модуль тестувався тільки на чистих Opencart та OcStore 3-ї версії, немає інформації щодо конфліктів з шаблонами, модулями і т.д. (але так як коду небагато то їх і не повинно бути)
  2. Підрахунок часу виконання запитів в бд не є реальним, підраховується різниця у часі перед початком виконання запиту та після.

Деталі:

  1. Longest - відображення усіх запитів в бд з сортуванням за приблизним часом виконання (наголошую що саме за приблизним часом а не точним)
  2. Duplicates - збирає всі задубльовані запити в бд
  3. Queries - відображення усіх запитів за реальним порядком виконання, та з вібораженням трейсів
  4. Controllers - відображення всіх контроллерів які приймали участь у відображенні сторінки
  5. Models - відображення всіх моделей які приймали участь у відображенні сторінки
  6. Views - відображення всіх темплейтів які приймали участь у відображенні сторінки
  7. Languages - відображення всіх файлів локалізації які приймали участь у відображенні сторінки
  8. Data - повний массив данних які були передані в фінальний темплейт

Встановлення:

  • рекомендую почати з бекапу папки system
  • встановлюємо модуль debugbar.ocmod.zip через адмін панель
  • оновлюємо модифікатори
  • відкриваємо файл system/framework.php та вносимо деякий код:
Прихований текст

Спочатку шукаємо строку з кодом:

$registry->set('log', $log)

Та після неї прописуємо наступний код:

if(file_exists(DIR_SYSTEM . 'library/debugbar.php')){
	require_once(DIR_SYSTEM . 'library/debugbar.php');
	$debugbar = new Debugbar($config);	
}else{
	$debugbar = null;
}
$registry->set('debugbar', $debugbar);


Далі шукаємо строку з кодом:

$db = new DB($config->get('db_engine'), $config->get('db_hostname'), $config->get('db_username'), $config->get('db_password'), $config->get('db_database'), $config->get('db_port'));

Та замінюємо її на:

$db = new DB($config->get('db_engine'), $config->get('db_hostname'), $config->get('db_username'), $config->get('db_password'), $config->get('db_database'), $config->get('db_port'), $debugbar);


Ну і останній крок, шукаємо строку:

$response->output();

Та перед нею прописуємо наступний код:
 

if(!is_null($debugbar)){
	$debugbar->end($registry);
}


На цьому все, та на всяк випадок прикріплю приклад повного файлу:

Прихований текст
<?php
// Registry
$registry = new Registry();

// Config
$config = new Config();
$config->load('default');
$config->load($application_config);
$registry->set('config', $config);

// Log
$log = new Log($config->get('error_filename'));
$registry->set('log', $log);

if(file_exists(DIR_SYSTEM . 'library/debugbar.php')){
	require_once(DIR_SYSTEM . 'library/debugbar.php');
	$debugbar = new Debugbar($config);	
}else{
	$debugbar = null;
}
$registry->set('debugbar', $debugbar);

date_default_timezone_set($config->get('date_timezone'));

set_error_handler(function($code, $message, $file, $line) use($log, $config) {
	// error suppressed with @
	if (!(error_reporting() & $code)) {
		return false;
	}

	switch ($code) {
		case E_NOTICE:
		case E_USER_NOTICE:
			$error = 'Notice';
			break;
		case E_WARNING:
		case E_USER_WARNING:
			$error = 'Warning';
			break;
		case E_ERROR:
		case E_USER_ERROR:
			$error = 'Fatal Error';
			break;
		default:
			$error = 'Unknown';
			break;
	}

	if ($config->get('error_display')) {
		echo '<b>' . $error . '</b>: ' . $message . ' in <b>' . $file . '</b> on line <b>' . $line . '</b>';
	}

	if ($config->get('error_log')) {
		$log->write('PHP ' . $error . ':  ' . $message . ' in ' . $file . ' on line ' . $line);
	}

	return true;
});

// Event
$event = new Event($registry);
$registry->set('event', $event);

// Event Register
if ($config->has('action_event')) {
	foreach ($config->get('action_event') as $key => $value) {
		foreach ($value as $priority => $action) {
			$event->register($key, new Action($action), $priority);
		}
	}
}

// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);

// Request
$registry->set('request', new Request());

// Response
$response = new Response();
$response->addHeader('Content-Type: text/html; charset=utf-8');
$response->setCompression($config->get('config_compression'));
$registry->set('response', $response);

// Database
if ($config->get('db_autostart')) {
	$db = new DB($config->get('db_engine'), $config->get('db_hostname'), $config->get('db_username'), $config->get('db_password'), $config->get('db_database'), $config->get('db_port'), $debugbar);
	$registry->set('db', $db);

	// Sync PHP and DB time zones
	$db->query("SET time_zone = '" . $db->escape(date('P')) . "'");
}

// Session
$session = new Session($config->get('session_engine'), $registry);
$registry->set('session', $session);

if ($config->get('session_autostart')) {
	/*
	We are adding the session cookie outside of the session class as I believe
	PHP messed up in a big way handling sessions. Why in the hell is it so hard to
	have more than one concurrent session using cookies!

	Is it not better to have multiple cookies when accessing parts of the system
	that requires different cookie sessions for security reasons.

	Also cookies can be accessed via the URL parameters. So why force only one cookie
	for all sessions!
	*/

	if (isset($_COOKIE[$config->get('session_name')])) {
		$session_id = $_COOKIE[$config->get('session_name')];
	} else {
		$session_id = '';
	}

	$session->start($session_id);

	setcookie($config->get('session_name'), $session->getId(), ini_get('session.cookie_lifetime'), ini_get('session.cookie_path'), ini_get('session.cookie_domain'));
}

// Cache
$registry->set('cache', new Cache($config->get('cache_engine'), $config->get('cache_expire')));

// Url
if ($config->get('url_autostart')) {
	$registry->set('url', new Url($config->get('site_url'), $config->get('site_ssl')));
}

// Language
$language = new Language($config->get('language_directory'));
$registry->set('language', $language);

// Document
$registry->set('document', new Document());

// Config Autoload
if ($config->has('config_autoload')) {
	foreach ($config->get('config_autoload') as $value) {
		$loader->config($value);
	}
}

// Language Autoload
if ($config->has('language_autoload')) {
	foreach ($config->get('language_autoload') as $value) {
		$loader->language($value);
	}
}

// Library Autoload
if ($config->has('library_autoload')) {
	foreach ($config->get('library_autoload') as $value) {
		$loader->library($value);
	}
}

// Model Autoload
if ($config->has('model_autoload')) {
	foreach ($config->get('model_autoload') as $value) {
		$loader->model($value);
	}
}

// Route
$route = new Router($registry);

// Pre Actions
if ($config->has('action_pre_action')) {
	foreach ($config->get('action_pre_action') as $value) {
		$route->addPreAction(new Action($value));
	}
}

// Dispatch
$route->dispatch(new Action($config->get('action_router')), new Action($config->get('action_error')));

// Output
if(!is_null($debugbar)){
	$debugbar->end($registry);
}
$response->output();

 

 


DEMO

Характеристики

License type Доменов не ограничено
Activation method Без активации
Ioncube LoaderНі
В продажеДа
OpenCart3.0
ocStore3.0
OpenCart.Pro, ocShopНе проверялось
Get request to server of developerНі
If the developer server is unavailableДополнение работает
СкидкаNo
Template compatible...
AdaptationПлатная
LocalisationАнглійська
Версія1.0.0
File Size12.38 kB
Submitted11/30/2023
Updated11/04/2023
  • +1 2
  • Recently Browsing   0 members

    • No registered users viewing this page.
Guest
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.