Compare commits
No commits in common. "1.1.0.0" and "1.0.0.0" have entirely different histories.
@ -16,20 +16,13 @@ declare(strict_types=1);
|
||||
namespace D3\DebugBar\Application\Component;
|
||||
|
||||
use D3\DebugBar\Application\Models\Collectors\OxidConfigCollector;
|
||||
use D3\DebugBar\Application\Models\Collectors\OxidShopCollector;
|
||||
use D3\DebugBar\Application\Models\Collectors\OxidVersionCollector;
|
||||
use D3\DebugBar\Application\Models\Collectors\SmartyCollector;
|
||||
use D3\DebugBar\Application\Models\TimeDataCollectorHandler;
|
||||
use DebugBar\Bridge\DoctrineCollector;
|
||||
use DebugBar\Bridge\MonologCollector;
|
||||
use DebugBar\DataCollector\MemoryCollector;
|
||||
use DebugBar\DataCollector\MessagesCollector;
|
||||
use DebugBar\DataCollector\PhpInfoCollector;
|
||||
use DebugBar\DataCollector\RequestDataCollector;
|
||||
use DebugBar\DataCollector\TimeDataCollector;
|
||||
use DebugBar\DebugBar;
|
||||
use DebugBar\DebugBarException;
|
||||
use DebugBar\JavascriptRenderer;
|
||||
use DebugBar\StandardDebugBar;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Logging\DebugStack;
|
||||
use Monolog\Logger;
|
||||
@ -42,7 +35,7 @@ use ReflectionException;
|
||||
|
||||
class DebugBarComponent extends BaseController
|
||||
{
|
||||
/** @var DebugBar */
|
||||
/** @var StandardDebugBar */
|
||||
protected $debugBar;
|
||||
/** @var JavascriptRenderer */
|
||||
protected $debugBarRenderer;
|
||||
@ -63,7 +56,7 @@ class DebugBarComponent extends BaseController
|
||||
parent::__construct();
|
||||
|
||||
if (false === isAdmin()) {
|
||||
$debugbar = new DebugBar();
|
||||
$debugbar = new StandardDebugBar();
|
||||
|
||||
$this->addCollectors($debugbar);
|
||||
|
||||
@ -109,14 +102,6 @@ class DebugBarComponent extends BaseController
|
||||
return new SmartyCollector($smarty);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OxidShopCollector
|
||||
*/
|
||||
public function getOxidShopCollector(): OxidShopCollector
|
||||
{
|
||||
return oxNew(OxidShopCollector::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OxidConfigCollector
|
||||
*/
|
||||
@ -125,14 +110,6 @@ class DebugBarComponent extends BaseController
|
||||
return oxNew(OxidConfigCollector::class, Registry::getConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return OxidVersionCollector
|
||||
*/
|
||||
public function getOxidVersionCollector(): OxidVersionCollector
|
||||
{
|
||||
return oxNew(OxidVersionCollector::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $object
|
||||
* @param string $propName
|
||||
@ -149,28 +126,18 @@ class DebugBarComponent extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DebugBar $debugbar
|
||||
* @param StandardDebugBar $debugbar
|
||||
* @return void
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DebugBarException
|
||||
* @throws ReflectionException
|
||||
*/
|
||||
public function addCollectors(DebugBar $debugbar): void
|
||||
public function addCollectors(StandardDebugBar $debugbar): void
|
||||
{
|
||||
// add all default collectors except the useless ExceptionCollector
|
||||
$debugbar->addCollector(new PhpInfoCollector());
|
||||
$debugbar->addCollector(new MessagesCollector());
|
||||
$debugbar->addCollector(new RequestDataCollector());
|
||||
$debugbar->addCollector(new TimeDataCollector());
|
||||
$debugbar->addCollector(new MemoryCollector());
|
||||
|
||||
// add custom collectors
|
||||
$debugbar->addCollector($this->getOxidShopCollector());
|
||||
$debugbar->addCollector($this->getOxidConfigCollector());
|
||||
$debugbar->addCollector($this->getSmartyCollector());
|
||||
$debugbar->addCollector($this->getMonologCollector());
|
||||
$debugbar->addCollector($this->getDoctrineCollector());
|
||||
$debugbar->addCollector($this->getOxidVersionCollector());
|
||||
$debugbar->addCollector($this->getSmartyCollector());
|
||||
$debugbar->addCollector($this->getOxidConfigCollector());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,9 +155,9 @@ class DebugBarComponent extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DebugBar
|
||||
* @return StandardDebugBar
|
||||
*/
|
||||
public function getDebugBar(): DebugBar
|
||||
public function getDebugBar(): StandardDebugBar
|
||||
{
|
||||
return $this->debugBar;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class OxidConfigCollector extends DataCollector implements Renderable
|
||||
: "PhpDebugBar.Widgets.VariableListWidget";
|
||||
return [
|
||||
"Configuration" => [
|
||||
"icon" => "database",
|
||||
"icon" => "tags",
|
||||
"widget" => $widget,
|
||||
"map" => "oxidconfig.vars",
|
||||
"default" => "{}",
|
||||
|
@ -1,143 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* https://www.d3data.de
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||
* @link https://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\DebugBar\Application\Models\Collectors;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use DebugBar\DataCollector\DataCollector;
|
||||
use DebugBar\DataCollector\Renderable;
|
||||
use OxidEsales\Eshop\Core\Config;
|
||||
use OxidEsales\Eshop\Core\Module\Module;
|
||||
use OxidEsales\Eshop\Core\ShopVersion;
|
||||
use OxidEsales\Eshop\Core\Theme;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ShopConfigurationDaoBridgeInterface;
|
||||
use OxidEsales\Facts\Facts;
|
||||
|
||||
class OxidShopCollector extends DataCollector implements Renderable
|
||||
{
|
||||
/** @var Config */
|
||||
protected $config;
|
||||
|
||||
/** @var array */
|
||||
protected $configVars = [];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $useHtmlVarDumper = true;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$facts = new Facts();
|
||||
$theme = new Theme();
|
||||
$parentThemeId = $theme->getParent() ? $theme->getParent()->getId() : '--';
|
||||
|
||||
$moduleList = $this->getInstalledModules();
|
||||
array_walk(
|
||||
$moduleList,
|
||||
function (Module &$module) {
|
||||
$str = trim(strip_tags($module->getTitle())).' - '.$module->getInfo('version').' ';
|
||||
$module = $str;
|
||||
}
|
||||
);
|
||||
|
||||
$this->configVars = [
|
||||
'Shop Edition:' => $facts->getEdition(),
|
||||
'Shop Version:' => ShopVersion::getVersion(),
|
||||
'CE Version:' => InstalledVersions::getVersion('oxid-esales/oxideshop-ce'),
|
||||
'Theme:' => $theme->getActiveThemeId(),
|
||||
'Parent Theme:' => $parentThemeId,
|
||||
'Modules:' => implode(chr(10), $moduleList)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return 'oxidshop';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function collect(): array
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$vars = $this->configVars;
|
||||
|
||||
foreach ($vars as $idx => $var) {
|
||||
if ($this->isHtmlVarDumperUsed()) {
|
||||
$data[$idx] = $this->getVarDumper()->renderVar($var);
|
||||
} else {
|
||||
$data[$idx] = $this->getDataFormatter()->formatVar($var);
|
||||
}
|
||||
}
|
||||
|
||||
return ['vars' => $data, 'count' => count($data)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
|
||||
* rendering.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function isHtmlVarDumperUsed()
|
||||
{
|
||||
return $this->useHtmlVarDumper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getWidgets(): array
|
||||
{
|
||||
$widget = $this->isHtmlVarDumperUsed()
|
||||
? "PhpDebugBar.Widgets.HtmlVariableListWidget"
|
||||
: "PhpDebugBar.Widgets.VariableListWidget";
|
||||
return [
|
||||
"Shop" => [
|
||||
"icon" => "shopping-cart",
|
||||
"widget" => $widget,
|
||||
"map" => $this->getName().".vars",
|
||||
"default" => "{}",
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
protected function getInstalledModules(): array
|
||||
{
|
||||
$container = ContainerFactory::getInstance()->getContainer();
|
||||
$shopConfiguration = $container->get(ShopConfigurationDaoBridgeInterface::class)->get();
|
||||
|
||||
$modules = [];
|
||||
|
||||
foreach ($shopConfiguration->getModuleConfigurations() as $moduleConfiguration) {
|
||||
$module = oxNew(Module::class);
|
||||
$module->load($moduleConfiguration->getId());
|
||||
$modules[] = $module;
|
||||
}
|
||||
|
||||
usort($modules, function ($a, $b) {
|
||||
return strcmp($a->getTitle(), $b->getTitle());
|
||||
});
|
||||
|
||||
return $modules;
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* https://www.d3data.de
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||
* @link https://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\DebugBar\Application\Models\Collectors;
|
||||
|
||||
use DebugBar\DataCollector\DataCollector;
|
||||
use DebugBar\DataCollector\Renderable;
|
||||
use OxidEsales\Eshop\Core\ShopVersion;
|
||||
use OxidEsales\Eshop\Core\Theme;
|
||||
use OxidEsales\Facts\Facts;
|
||||
|
||||
/**
|
||||
* Collects info about OXID shop
|
||||
*/
|
||||
class OxidVersionCollector extends DataCollector implements Renderable
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'oxidversion';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function collect()
|
||||
{
|
||||
$facts = new Facts();
|
||||
$theme = new Theme();
|
||||
$parentThemeId = $theme->getParent() ? $theme->getParent()->getId() : '--';
|
||||
|
||||
return array(
|
||||
'version' => $facts->getEdition().' '.ShopVersion::getVersion()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
$collect = $this->collect();
|
||||
|
||||
return [
|
||||
"oxidversion" => [
|
||||
"icon" => "shopping-cart",
|
||||
"tooltip" => 'OXID Version',
|
||||
"map" => $this->getName().".version",
|
||||
"default" => ""
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
*
|
||||
* https://www.d3data.de
|
||||
*
|
||||
* @copyright (c) 2016 Dmitry Kosenkov
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||
* @link https://www.oxidmodule.com
|
||||
@ -102,7 +101,7 @@ class SmartyCollector extends DataCollector implements Renderable
|
||||
: "PhpDebugBar.Widgets.VariableListWidget";
|
||||
return [
|
||||
"smarty" => [
|
||||
"icon" => "file-text",
|
||||
"icon" => "tags",
|
||||
"widget" => $widget,
|
||||
"map" => "smarty.vars",
|
||||
"default" => "{}",
|
||||
|
14
CHANGELOG.md
14
CHANGELOG.md
@ -4,19 +4,7 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased](https://git.d3data.de/D3Public/DebugBar/compare/1.1.0.0...rel_1.x)
|
||||
|
||||
## [1.1.0.0](https://git.d3data.de/D3Public/DebugBar/compare/1.0.0.0...1.1.0.0) - 2022-08-05
|
||||
### Added
|
||||
- shop edition and version information directly in the bar
|
||||
- basic shop informations (edition, version, theme informations) in the shop tab
|
||||
|
||||
### Changed
|
||||
- reorder tabs
|
||||
- adjust tab icons for small viewports
|
||||
|
||||
### removed
|
||||
- useless exceptions tab
|
||||
## [Unreleased](https://git.d3data.de/D3Public/DebugBar/compare/1.0.0.0...rel_1.x)
|
||||
|
||||
## [1.0.0.0](https://git.d3data.de/D3Public/DebugBar/releases/tag/1.0.0.0) - 2022-07-30
|
||||
### Added
|
||||
|
18
README.en.md
18
README.en.md
@ -10,11 +10,10 @@ The debug bar enables the display of relevant debug information in the shop fron
|
||||
## Table of content
|
||||
|
||||
- [Installation](#installation)
|
||||
- [How to use](#how-to-use)
|
||||
- [Changelog](#changelog)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
- [Further licenses and terms of use](#further-licenses-and-terms-of-use)
|
||||
- [Further licences and terms of use](#further-licences-and-terms-of-use)
|
||||
|
||||
## Installation
|
||||
|
||||
@ -40,6 +39,7 @@ Please enter the following section in the `composer.json` of your project:
|
||||
|
||||
Open a command line and navigate to the root directory of the shop (parent directory of source and vendor). Execute the following command. Adapt the path details to your installation environment.
|
||||
|
||||
|
||||
```bash
|
||||
php composer require d3/oxid-debugbar:^1.0
|
||||
```
|
||||
@ -50,25 +50,21 @@ Activate the module in Shopadmin under "Extensions -> Modules".
|
||||
|
||||
## How to use
|
||||
|
||||
__Please note that the DebugBar contains security-relevant information. It should therefore not be activated under any circumstances in a freely accessible installation.__
|
||||
|
||||
The DebugBar displays the following tabs:
|
||||
- Messages
|
||||
can contain individual debug output. The messages can be set within the PHP code with `debugVar($message)` and corresponds to the OXID function `dumpVar(...)`
|
||||
can contain individual debug output. Messages can be set within the PHP code with `debugVar($message)` and corresponds to the OXID function `dumpVar(...)`
|
||||
- Request
|
||||
shows all information from GET and POST requests, as well as session, cookie and server variables
|
||||
- Timeline
|
||||
displays all areas defined with `startProfile` and `stopProfile` with single and summed execution time as well as a waterfall diagram
|
||||
- Shop
|
||||
shows basic shop information (edition, versions, theme information)
|
||||
- Configuration
|
||||
provides all configuration settings of the shop from database and config files
|
||||
- Smarty
|
||||
lists all variables of the template engine that are available on the current shop page
|
||||
- Monolog
|
||||
lists all log messages passed to the Monolog Logger
|
||||
- Database
|
||||
shows all database queries necessary to generate the current page
|
||||
- Smarty
|
||||
lists all Smarty variables available on the current shop page
|
||||
- Configuration
|
||||
Provides all configuration settings of the shop (from database and file).
|
||||
|
||||
## Changelog
|
||||
|
||||
|
14
README.md
14
README.md
@ -10,7 +10,6 @@ Die Debug Bar ermöglicht die Darstellung relevanter Debuginformationen im Shopf
|
||||
## Inhaltsverzeichnis
|
||||
|
||||
- [Installation](#installation)
|
||||
- [Verwendung](#verwendung)
|
||||
- [Changelog](#changelog)
|
||||
- [Beitragen](#beitragen)
|
||||
- [Lizenz](#lizenz)
|
||||
@ -40,6 +39,7 @@ Bitte tragen Sie den folgenden Abschnitt in die `composer.json` Ihres Projektes
|
||||
|
||||
Öffnen Sie eine Kommandozeile und navigieren Sie zum Stammverzeichnis des Shops (Elternverzeichnis von source und vendor). Führen Sie den folgenden Befehl aus. Passen Sie die Pfadangaben an Ihre Installationsumgebung an.
|
||||
|
||||
|
||||
```bash
|
||||
php composer require d3/oxid-debugbar:^1.0
|
||||
```
|
||||
@ -50,8 +50,6 @@ Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||
|
||||
## Verwendung
|
||||
|
||||
__Bitte beachten Sie, dass die DebugBar sicherheitsrelevante Informationen enthält. Diese sollte daher unter keinen Umständen in einer frei zugänglichen Installation aktiviert sein.__
|
||||
|
||||
Die DebugBar stellt folgende Tabs dar:
|
||||
- Messages
|
||||
kann individuelle Debugausgaben enthalten. Die Nachrichten können innerhalb des PHP-Codes mit `debugVar($message)` gesetzt werden und entspricht der OXID-Funktion `dumpVar(...)`.
|
||||
@ -59,16 +57,14 @@ Die DebugBar stellt folgende Tabs dar:
|
||||
zeigt alle Angaben aus GET- und POST-Requests, sowie Session-, Cookie- und Servervariablen
|
||||
- Timeline
|
||||
stellt alle mit `startProfile` und `stopProfile` definierten Bereiche mit einzelner und summierter Ausführungszeit sowie als Wasserfalldiagramm dar
|
||||
- Shop
|
||||
zeigt grundlegende Shopinformationen (Edition, Versionen, Themeinformationen)
|
||||
- Configuration
|
||||
stellt alle Konfigurationseinstellungen des Shops aus Datenbank und config-Dateien zur Verfügung
|
||||
- Smarty
|
||||
listet alle Variablen der Template-Engine, die auf der aktuellen Shopseite zur Verfügung stehen
|
||||
- Monolog
|
||||
listet alle an den Monolog Logger übergebenen Lognachrichten
|
||||
- Database
|
||||
zeigt alle zur Generierung der aktuellen Seite nötigen Datenbankabfragen
|
||||
- Smarty
|
||||
listet alle Smarty-Variablen, die auf der aktuellen Shopseite zur Verfügung stehen
|
||||
- Configuration
|
||||
stellt alle Konfigurationseinstellungen des Shops aus Datenbank und Dateien zur Verfügung
|
||||
|
||||
## Changelog
|
||||
|
||||
|
5
ToDo.md
5
ToDo.md
@ -1,5 +0,0 @@
|
||||
# ToDo
|
||||
|
||||
- clear tmp button
|
||||
- phpinfo() overview
|
||||
- automatic switch between Smarty and Twig
|
BIN
screenshot.jpg
BIN
screenshot.jpg
Binary file not shown.
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 59 KiB |
Loading…
Reference in New Issue
Block a user