Compare commits
36 Commits
1.1.0.0
...
dev_2.x_OX
Author | SHA1 | Date | |
---|---|---|---|
cdf21175e5
|
|||
b58391c02c | |||
153ce3f5ec | |||
f3b9c89cc9 | |||
556379bc46 | |||
8f0c912dca | |||
ce035a9742 | |||
6534af14c3 | |||
29940a97d1 | |||
b02708f5ae | |||
843c49e137 | |||
16c524bd1a | |||
f54713acb8 | |||
1309aa5976 | |||
f3a7b00ea8 | |||
1ead3a427e | |||
0033d52f8f
|
|||
ab7e4fa595
|
|||
8dab80e4d9
|
|||
81acc92151
|
|||
0c79c1c77a
|
|||
da26d03d58
|
|||
b1897c8ecf
|
|||
09608bfd91
|
|||
4c21a850d8
|
|||
a9c1863a8e
|
|||
75146c8a08
|
|||
6eb4c213b9
|
|||
922d26d3ac
|
|||
88b6a1d6fa
|
|||
236680ad7a
|
|||
ff606efef3
|
|||
4b47e5ddb6
|
|||
154a28f118
|
|||
c892b3bd03
|
|||
a87bc1d9bd
|
@ -1,13 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$finder = PhpCsFixer\Finder::create()
|
declare(strict_types=1);
|
||||||
->in(__DIR__)
|
|
||||||
;
|
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
|
||||||
|
|
||||||
|
$header = <<<EOF
|
||||||
|
Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
|
||||||
|
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
|
||||||
|
EOF;
|
||||||
|
|
||||||
$config = new PhpCsFixer\Config();
|
$config = new PhpCsFixer\Config();
|
||||||
return $config->setRules([
|
return $config->setRules(
|
||||||
'@PHP73Migration' => true,
|
[
|
||||||
'@PSR12' => true
|
'@PHP80Migration' => true,
|
||||||
])
|
'@PSR12' => true,
|
||||||
->setFinder($finder)
|
'header_comment' => [
|
||||||
;
|
'comment_type' => 'PHPDoc',
|
||||||
|
'header' => $header,
|
||||||
|
'location' => 'after_open',
|
||||||
|
'separate' => 'both',
|
||||||
|
],
|
||||||
|
'php_unit_test_class_requires_covers' => true,
|
||||||
|
'doctrine_annotation_indentation' => true,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
->setFinder($finder);
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -15,13 +17,17 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace D3\DebugBar\Application\Component;
|
namespace D3\DebugBar\Application\Component;
|
||||||
|
|
||||||
|
use D3\DebugBar\Application\Models\AvailabilityCheck;
|
||||||
use D3\DebugBar\Application\Models\Collectors\OxidConfigCollector;
|
use D3\DebugBar\Application\Models\Collectors\OxidConfigCollector;
|
||||||
use D3\DebugBar\Application\Models\Collectors\OxidShopCollector;
|
use D3\DebugBar\Application\Models\Collectors\OxidShopCollector;
|
||||||
use D3\DebugBar\Application\Models\Collectors\OxidVersionCollector;
|
use D3\DebugBar\Application\Models\Collectors\OxidVersionCollector;
|
||||||
use D3\DebugBar\Application\Models\Collectors\SmartyCollector;
|
use D3\DebugBar\Application\Models\Collectors\TemplateVariablesCollector;
|
||||||
|
use D3\DebugBar\Application\Models\Exceptions\UnavailableException;
|
||||||
use D3\DebugBar\Application\Models\TimeDataCollectorHandler;
|
use D3\DebugBar\Application\Models\TimeDataCollectorHandler;
|
||||||
use DebugBar\Bridge\DoctrineCollector;
|
use DebugBar\Bridge\DoctrineCollector;
|
||||||
use DebugBar\Bridge\MonologCollector;
|
use DebugBar\Bridge\MonologCollector;
|
||||||
|
use DebugBar\Bridge\NamespacedTwigProfileCollector;
|
||||||
|
use DebugBar\DataCollector\ExceptionsCollector;
|
||||||
use DebugBar\DataCollector\MemoryCollector;
|
use DebugBar\DataCollector\MemoryCollector;
|
||||||
use DebugBar\DataCollector\MessagesCollector;
|
use DebugBar\DataCollector\MessagesCollector;
|
||||||
use DebugBar\DataCollector\PhpInfoCollector;
|
use DebugBar\DataCollector\PhpInfoCollector;
|
||||||
@ -34,18 +40,23 @@ use Doctrine\DBAL\Connection;
|
|||||||
use Doctrine\DBAL\Logging\DebugStack;
|
use Doctrine\DBAL\Logging\DebugStack;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use OxidEsales\Eshop\Core\Controller\BaseController;
|
use OxidEsales\Eshop\Core\Controller\BaseController;
|
||||||
use OxidEsales\Eshop\Core\DatabaseProvider;
|
|
||||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionProviderInterface;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRenderer;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridge;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
|
||||||
|
use OxidEsales\Twig\TwigEngine;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
|
use Twig\Profiler\Profile;
|
||||||
|
|
||||||
class DebugBarComponent extends BaseController
|
class DebugBarComponent extends BaseController
|
||||||
{
|
{
|
||||||
/** @var DebugBar */
|
protected DebugBar|null $debugBar = null;
|
||||||
protected $debugBar;
|
protected null|JavascriptRenderer $debugBarRenderer = null;
|
||||||
/** @var JavascriptRenderer */
|
|
||||||
protected $debugBarRenderer;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marking object as component
|
* Marking object as component
|
||||||
@ -54,15 +65,15 @@ class DebugBarComponent extends BaseController
|
|||||||
protected $_blIsComponent = true;
|
protected $_blIsComponent = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
* @throws DebugBarException
|
* @throws DebugBarException
|
||||||
* @throws DatabaseConnectionException
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
if (false === isAdmin()) {
|
if (AvailabilityCheck::isAvailable()) {
|
||||||
$debugbar = new DebugBar();
|
$debugbar = new DebugBar();
|
||||||
|
|
||||||
$this->addCollectors($debugbar);
|
$this->addCollectors($debugbar);
|
||||||
@ -86,27 +97,50 @@ class DebugBarComponent extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DoctrineCollector
|
* @return DoctrineCollector
|
||||||
* @throws ReflectionException
|
* @throws ContainerExceptionInterface
|
||||||
* @throws DebugBarException
|
* @throws DebugBarException
|
||||||
* @throws DatabaseConnectionException
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function getDoctrineCollector(): DoctrineCollector
|
public function getDoctrineCollector(): DoctrineCollector
|
||||||
{
|
{
|
||||||
$db = DatabaseProvider::getDb();
|
|
||||||
$debugStack = new DebugStack();
|
|
||||||
/** @var Connection $connection */
|
/** @var Connection $connection */
|
||||||
$connection = $this->getNonPublicProperty($db, 'connection');
|
$connection = ContainerFactory::getInstance()->getContainer()->get(ConnectionProviderInterface::class)->get();
|
||||||
|
$debugStack = new DebugStack();
|
||||||
$connection->getConfiguration()->setSQLLogger($debugStack);
|
$connection->getConfiguration()->setSQLLogger($debugStack);
|
||||||
return new DoctrineCollector($debugStack);
|
return new DoctrineCollector($debugStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return SmartyCollector
|
* @return TemplateVariablesCollector
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function getSmartyCollector(): SmartyCollector
|
public function getTemplateVariablesCollector(): TemplateVariablesCollector
|
||||||
{
|
{
|
||||||
$smarty = Registry::getUtilsView()->getSmarty();
|
/** @var TemplateRenderer $renderer */
|
||||||
return new SmartyCollector($smarty);
|
$renderer = ContainerFactory::getInstance()->getContainer()
|
||||||
|
->get(TemplateRendererBridgeInterface::class)
|
||||||
|
->getTemplateRenderer();
|
||||||
|
$templateEngine = $renderer->getTemplateEngine();
|
||||||
|
|
||||||
|
return new TemplateVariablesCollector(
|
||||||
|
array_merge(
|
||||||
|
Registry::getConfig()->getActiveView()->getViewData(),
|
||||||
|
$templateEngine->getGlobals()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return NamespacedTwigProfileCollector
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
public function getTwigCollector(): NamespacedTwigProfileCollector
|
||||||
|
{
|
||||||
|
/** @var Profile $profile */
|
||||||
|
$profile = ContainerFactory::getInstance()->getContainer()->get(Profile::class);
|
||||||
|
return new NamespacedTwigProfileCollector($profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,27 +167,12 @@ class DebugBarComponent extends BaseController
|
|||||||
return oxNew(OxidVersionCollector::class);
|
return oxNew(OxidVersionCollector::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param object $object
|
|
||||||
* @param string $propName
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
|
||||||
protected function getNonPublicProperty(object $object, string $propName)
|
|
||||||
{
|
|
||||||
$reflection = new ReflectionClass($object);
|
|
||||||
$property = $reflection->getProperty($propName);
|
|
||||||
$property->setAccessible(true);
|
|
||||||
return $property->getValue($object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param DebugBar $debugbar
|
* @param DebugBar $debugbar
|
||||||
* @return void
|
* @return void
|
||||||
* @throws DatabaseConnectionException
|
* @throws ContainerExceptionInterface
|
||||||
* @throws DebugBarException
|
* @throws DebugBarException
|
||||||
* @throws ReflectionException
|
* @throws NotFoundExceptionInterface
|
||||||
*/
|
*/
|
||||||
public function addCollectors(DebugBar $debugbar): void
|
public function addCollectors(DebugBar $debugbar): void
|
||||||
{
|
{
|
||||||
@ -163,11 +182,23 @@ class DebugBarComponent extends BaseController
|
|||||||
$debugbar->addCollector(new RequestDataCollector());
|
$debugbar->addCollector(new RequestDataCollector());
|
||||||
$debugbar->addCollector(new TimeDataCollector());
|
$debugbar->addCollector(new TimeDataCollector());
|
||||||
$debugbar->addCollector(new MemoryCollector());
|
$debugbar->addCollector(new MemoryCollector());
|
||||||
|
$debugbar->addCollector(new ExceptionsCollector());
|
||||||
|
|
||||||
// add custom collectors
|
// add custom collectors
|
||||||
$debugbar->addCollector($this->getOxidShopCollector());
|
$debugbar->addCollector($this->getOxidShopCollector());
|
||||||
$debugbar->addCollector($this->getOxidConfigCollector());
|
$debugbar->addCollector($this->getOxidConfigCollector());
|
||||||
$debugbar->addCollector($this->getSmartyCollector());
|
$debugbar->addCollector($this->getTemplateVariablesCollector());
|
||||||
|
|
||||||
|
/** @var TemplateRendererBridge $templateRendererBridge */
|
||||||
|
$templateRendererBridge = ContainerFactory::getInstance()->getContainer()->get(TemplateRendererBridgeInterface::class);
|
||||||
|
switch (get_class($templateRendererBridge->getTemplateRenderer()->getTemplateEngine())) {
|
||||||
|
case TwigEngine::class:
|
||||||
|
$debugbar->addCollector($this->getTwigCollector());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dumpvar(get_class($templateRendererBridge->getTemplateRenderer()->getTemplateEngine()));
|
||||||
|
}
|
||||||
|
|
||||||
$debugbar->addCollector($this->getMonologCollector());
|
$debugbar->addCollector($this->getMonologCollector());
|
||||||
$debugbar->addCollector($this->getDoctrineCollector());
|
$debugbar->addCollector($this->getDoctrineCollector());
|
||||||
$debugbar->addCollector($this->getOxidVersionCollector());
|
$debugbar->addCollector($this->getOxidVersionCollector());
|
||||||
@ -175,9 +206,15 @@ class DebugBarComponent extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws UnavailableException
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function addTimelineMessures(): void
|
public function addTimelineMeasures(): void
|
||||||
{
|
{
|
||||||
|
if (false === $this->debugBar instanceof DebugBar) {
|
||||||
|
throw new UnavailableException();
|
||||||
|
}
|
||||||
|
|
||||||
$collectors = $this->debugBar->getCollectors();
|
$collectors = $this->debugBar->getCollectors();
|
||||||
$collectors['time'] = TimeDataCollectorHandler::getInstance();
|
$collectors['time'] = TimeDataCollectorHandler::getInstance();
|
||||||
|
|
||||||
@ -189,9 +226,14 @@ class DebugBarComponent extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DebugBar
|
* @return DebugBar
|
||||||
|
* @throws UnavailableException
|
||||||
*/
|
*/
|
||||||
public function getDebugBar(): DebugBar
|
public function getDebugBar(): DebugBar
|
||||||
{
|
{
|
||||||
|
if (false === $this->debugBar instanceof DebugBar) {
|
||||||
|
throw new UnavailableException();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->debugBar;
|
return $this->debugBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
84
Application/Models/AvailabilityCheck.php
Normal file
84
Application/Models/AvailabilityCheck.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
|
class AvailabilityCheck
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function isAvailable(): bool
|
||||||
|
{
|
||||||
|
return !isAdmin() && (
|
||||||
|
Registry::getConfig()->getShopConfVar('d3debugbar_showForAdminUsersOnly') != true ||
|
||||||
|
self::userIsMallAdmin()
|
||||||
|
) && !Registry::getConfig()->isProductiveMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function userIsMallAdmin(): bool
|
||||||
|
{
|
||||||
|
$user = Registry::getConfig()->getUser();
|
||||||
|
return $user != null &&
|
||||||
|
$user->isMallAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function ifDebugBarNotSet(): bool
|
||||||
|
{
|
||||||
|
global $debugBarSet;
|
||||||
|
|
||||||
|
return $debugBarSet !== 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function markDebugBarAsSet(): void
|
||||||
|
{
|
||||||
|
global $debugBarSet;
|
||||||
|
|
||||||
|
$debugBarSet = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function ifNoErrorOccured(): bool
|
||||||
|
{
|
||||||
|
global $debugBarErrorOccured;
|
||||||
|
|
||||||
|
return $debugBarErrorOccured !== 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function markErrorOccured(): void
|
||||||
|
{
|
||||||
|
global $debugBarErrorOccured;
|
||||||
|
|
||||||
|
$debugBarErrorOccured = 1;
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -20,32 +22,64 @@ use DebugBar\DataCollector\Renderable;
|
|||||||
use OxidEsales\Eshop\Core\Config;
|
use OxidEsales\Eshop\Core\Config;
|
||||||
use OxidEsales\Eshop\Core\ConfigFile;
|
use OxidEsales\Eshop\Core\ConfigFile;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ShopConfigurationDaoBridge;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ShopConfigurationDaoBridgeInterface;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
|
|
||||||
class OxidConfigCollector extends DataCollector implements Renderable
|
class OxidConfigCollector extends DataCollector implements Renderable
|
||||||
{
|
{
|
||||||
/** @var Config */
|
public const HIDDEN_TEXT = '[hidden]';
|
||||||
protected $config;
|
|
||||||
|
|
||||||
/** @var array */
|
protected array $configVars = [];
|
||||||
protected $configVars = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @param Config $config
|
||||||
|
*
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
protected $useHtmlVarDumper = false;
|
|
||||||
|
|
||||||
public function __construct(Config $config)
|
public function __construct(Config $config)
|
||||||
{
|
{
|
||||||
$config->init();
|
$config->init();
|
||||||
$this->config = $config;
|
|
||||||
$this->configVars = array_merge(
|
$this->configVars['config table'] = (array) $this->getNonPublicProperty($config, '_aConfigParams');
|
||||||
(array) $this->getNonPublicProperty($this->config, '_aConfigParams'),
|
$this->configVars['config file'] = Registry::get(ConfigFile::class)->getVars();
|
||||||
Registry::get(ConfigFile::class)->getVars()
|
$this->configVars = array_merge($this->configVars, $this->getModuleSettings());
|
||||||
);
|
|
||||||
|
|
||||||
$this->sanitizeCriticalProperties();
|
$this->sanitizeCriticalProperties();
|
||||||
|
|
||||||
|
$this->useHtmlVarDumper(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
|
protected function getModuleSettings(): array
|
||||||
|
{
|
||||||
|
$container = ContainerFactory::getInstance()->getContainer();
|
||||||
|
/** @var ShopConfigurationDaoBridge $shopConfigurationDaoBridge */
|
||||||
|
$shopConfigurationDaoBridge = $container->get(ShopConfigurationDaoBridgeInterface::class);
|
||||||
|
$shopConfiguration = $shopConfigurationDaoBridge->get();
|
||||||
|
|
||||||
|
$moduleSettings = [];
|
||||||
|
|
||||||
|
foreach ($shopConfiguration->getModuleConfigurations() as $moduleConfiguration) {
|
||||||
|
foreach ($moduleConfiguration->getModuleSettings() as $setting) {
|
||||||
|
$moduleSettings[$moduleConfiguration->getId()][$setting->getName()] =
|
||||||
|
strtolower($setting->getType()) == 'password' ?
|
||||||
|
self::HIDDEN_TEXT :
|
||||||
|
$setting->getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $moduleSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,11 +91,13 @@ class OxidConfigCollector extends DataCollector implements Renderable
|
|||||||
$specific = ['sSerialNr', 'aSerials', 'dbPwd'];
|
$specific = ['sSerialNr', 'aSerials', 'dbPwd'];
|
||||||
$search = array_merge($generic, $specific);
|
$search = array_merge($generic, $specific);
|
||||||
|
|
||||||
array_walk($this->configVars, function ($item, $key) use ($search) {
|
foreach ($this->configVars as $group => $values) {
|
||||||
if (in_array($key, $search)) {
|
array_walk($this->configVars[$group], function ($item, $key) use ($group, $search) {
|
||||||
$this->configVars[$key] = '[hidden]';
|
if (in_array($key, $search)) {
|
||||||
}
|
$this->configVars[$group][ $key ] = self::HIDDEN_TEXT;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,7 +107,7 @@ class OxidConfigCollector extends DataCollector implements Renderable
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
protected function getNonPublicProperty(object $object, string $propName)
|
protected function getNonPublicProperty(object $object, string $propName): mixed
|
||||||
{
|
{
|
||||||
$reflection = new ReflectionClass($object);
|
$reflection = new ReflectionClass($object);
|
||||||
$property = $reflection->getProperty($propName);
|
$property = $reflection->getProperty($propName);
|
||||||
@ -107,17 +143,6 @@ class OxidConfigCollector extends DataCollector implements Renderable
|
|||||||
return ['vars' => $data, 'count' => count($data)];
|
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
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -18,39 +20,43 @@ namespace D3\DebugBar\Application\Models\Collectors;
|
|||||||
use Composer\InstalledVersions;
|
use Composer\InstalledVersions;
|
||||||
use DebugBar\DataCollector\DataCollector;
|
use DebugBar\DataCollector\DataCollector;
|
||||||
use DebugBar\DataCollector\Renderable;
|
use DebugBar\DataCollector\Renderable;
|
||||||
|
use Exception;
|
||||||
use OxidEsales\Eshop\Core\Config;
|
use OxidEsales\Eshop\Core\Config;
|
||||||
use OxidEsales\Eshop\Core\Module\Module;
|
|
||||||
use OxidEsales\Eshop\Core\ShopVersion;
|
use OxidEsales\Eshop\Core\ShopVersion;
|
||||||
use OxidEsales\Eshop\Core\Theme;
|
use OxidEsales\Eshop\Core\Theme;
|
||||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ShopConfigurationDaoBridge;
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ShopConfigurationDaoBridgeInterface;
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ShopConfigurationDaoBridgeInterface;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\DataObject\ModuleConfiguration;
|
||||||
use OxidEsales\Facts\Facts;
|
use OxidEsales\Facts\Facts;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
|
||||||
class OxidShopCollector extends DataCollector implements Renderable
|
class OxidShopCollector extends DataCollector implements Renderable
|
||||||
{
|
{
|
||||||
/** @var Config */
|
protected Config $config;
|
||||||
protected $config;
|
|
||||||
|
|
||||||
/** @var array */
|
protected array $configVars = [];
|
||||||
protected $configVars = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected $useHtmlVarDumper = true;
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$facts = new Facts();
|
$facts = new Facts();
|
||||||
$theme = new Theme();
|
$theme = new Theme();
|
||||||
$parentThemeId = $theme->getParent() ? $theme->getParent()->getId() : '--';
|
/** @var Theme|null $parent */
|
||||||
|
$parent = $theme->getParent();
|
||||||
|
$parentThemeId = $parent ? $parent->getId() : '--';
|
||||||
|
|
||||||
$moduleList = $this->getInstalledModules();
|
$moduleList = $this->getInstalledModules();
|
||||||
|
$list = [];
|
||||||
array_walk(
|
array_walk(
|
||||||
$moduleList,
|
$moduleList,
|
||||||
function (Module &$module) {
|
function (ModuleConfiguration $module) use (&$list) {
|
||||||
$str = trim(strip_tags($module->getTitle())).' - '.$module->getInfo('version').' ';
|
$list[] = trim(strip_tags(current($module->getTitle()))).' - '.$module->getVersion();
|
||||||
$module = $str;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -60,8 +66,10 @@ class OxidShopCollector extends DataCollector implements Renderable
|
|||||||
'CE Version:' => InstalledVersions::getVersion('oxid-esales/oxideshop-ce'),
|
'CE Version:' => InstalledVersions::getVersion('oxid-esales/oxideshop-ce'),
|
||||||
'Theme:' => $theme->getActiveThemeId(),
|
'Theme:' => $theme->getActiveThemeId(),
|
||||||
'Parent Theme:' => $parentThemeId,
|
'Parent Theme:' => $parentThemeId,
|
||||||
'Modules:' => implode(chr(10), $moduleList)
|
'Modules:' => $list,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$this->useHtmlVarDumper(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,17 +100,6 @@ class OxidShopCollector extends DataCollector implements Renderable
|
|||||||
return ['vars' => $data, 'count' => count($data)];
|
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
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -121,21 +118,28 @@ class OxidShopCollector extends DataCollector implements Renderable
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ModuleConfiguration[]
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
protected function getInstalledModules(): array
|
protected function getInstalledModules(): array
|
||||||
{
|
{
|
||||||
$container = ContainerFactory::getInstance()->getContainer();
|
$container = ContainerFactory::getInstance()->getContainer();
|
||||||
$shopConfiguration = $container->get(ShopConfigurationDaoBridgeInterface::class)->get();
|
/** @var ShopConfigurationDaoBridge $shopConfigurationDaoBridge */
|
||||||
|
$shopConfigurationDaoBridge = $container->get(ShopConfigurationDaoBridgeInterface::class);
|
||||||
|
$shopConfiguration = $shopConfigurationDaoBridge->get();
|
||||||
|
|
||||||
$modules = [];
|
$modules = [];
|
||||||
|
|
||||||
foreach ($shopConfiguration->getModuleConfigurations() as $moduleConfiguration) {
|
foreach ($shopConfiguration->getModuleConfigurations() as $moduleConfiguration) {
|
||||||
$module = oxNew(Module::class);
|
$modules[] = $moduleConfiguration;
|
||||||
$module->load($moduleConfiguration->getId());
|
|
||||||
$modules[] = $module;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var $a ModuleConfiguration */
|
||||||
|
/** @var $b ModuleConfiguration */
|
||||||
usort($modules, function ($a, $b) {
|
usort($modules, function ($a, $b) {
|
||||||
return strcmp($a->getTitle(), $b->getTitle());
|
return strcmp(current($a->getTitle()), current($b->getTitle()));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $modules;
|
return $modules;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -16,8 +19,8 @@ namespace D3\DebugBar\Application\Models\Collectors;
|
|||||||
|
|
||||||
use DebugBar\DataCollector\DataCollector;
|
use DebugBar\DataCollector\DataCollector;
|
||||||
use DebugBar\DataCollector\Renderable;
|
use DebugBar\DataCollector\Renderable;
|
||||||
|
use Exception;
|
||||||
use OxidEsales\Eshop\Core\ShopVersion;
|
use OxidEsales\Eshop\Core\ShopVersion;
|
||||||
use OxidEsales\Eshop\Core\Theme;
|
|
||||||
use OxidEsales\Facts\Facts;
|
use OxidEsales\Facts\Facts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -28,38 +31,35 @@ class OxidVersionCollector extends DataCollector implements Renderable
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return 'oxidversion';
|
return 'oxidversion';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function collect()
|
public function collect(): array
|
||||||
{
|
{
|
||||||
$facts = new Facts();
|
$facts = new Facts();
|
||||||
$theme = new Theme();
|
|
||||||
$parentThemeId = $theme->getParent() ? $theme->getParent()->getId() : '--';
|
|
||||||
|
|
||||||
return array(
|
return [
|
||||||
'version' => $facts->getEdition().' '.ShopVersion::getVersion()
|
'version' => $facts->getEdition().' '.ShopVersion::getVersion(),
|
||||||
);
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* @return string[][]
|
||||||
*/
|
*/
|
||||||
public function getWidgets()
|
public function getWidgets(): array
|
||||||
{
|
{
|
||||||
$collect = $this->collect();
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
"oxidversion" => [
|
"oxidversion" => [
|
||||||
"icon" => "shopping-cart",
|
"icon" => "shopping-cart",
|
||||||
"tooltip" => 'OXID Version',
|
"tooltip" => 'OXID Version',
|
||||||
"map" => $this->getName().".version",
|
"map" => $this->getName().".version",
|
||||||
"default" => ""
|
"default" => "",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
* @copyright (c) 2016 Dmitry Kosenkov
|
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||||
* @link https://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
@ -19,49 +20,11 @@ namespace D3\DebugBar\Application\Models\Collectors;
|
|||||||
use DebugBar\DataCollector\DataCollector;
|
use DebugBar\DataCollector\DataCollector;
|
||||||
use DebugBar\DataCollector\Renderable;
|
use DebugBar\DataCollector\Renderable;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
use Smarty;
|
|
||||||
|
|
||||||
class SmartyCollector extends DataCollector implements Renderable
|
class TemplateVariablesCollector extends DataCollector implements Renderable
|
||||||
{
|
{
|
||||||
/** @var Smarty */
|
public function __construct(protected array $templateVariables)
|
||||||
protected $smarty;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $useHtmlVarDumper = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a flag indicating whether the Symfony HtmlDumper will be used to dump variables for
|
|
||||||
* rich variable rendering.
|
|
||||||
*
|
|
||||||
* @param bool $value
|
|
||||||
* @return $this
|
|
||||||
*/
|
|
||||||
public function useHtmlVarDumper($value = true)
|
|
||||||
{
|
{
|
||||||
$this->useHtmlVarDumper = $value;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
|
|
||||||
* rendering.
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function isHtmlVarDumperUsed()
|
|
||||||
{
|
|
||||||
return $this->useHtmlVarDumper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Smarty $smarty
|
|
||||||
*/
|
|
||||||
public function __construct(Smarty $smarty)
|
|
||||||
{
|
|
||||||
$this->smarty = $smarty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,7 +34,7 @@ class SmartyCollector extends DataCollector implements Renderable
|
|||||||
{
|
{
|
||||||
$data = ['current view template' => Registry::getConfig()->getTopActiveView()->getTemplateName()];
|
$data = ['current view template' => Registry::getConfig()->getTopActiveView()->getTemplateName()];
|
||||||
|
|
||||||
$vars = $this->smarty->get_template_vars();
|
$vars = $this->templateVariables;
|
||||||
|
|
||||||
foreach ($vars as $idx => $var) {
|
foreach ($vars as $idx => $var) {
|
||||||
if ($this->isHtmlVarDumperUsed()) {
|
if ($this->isHtmlVarDumperUsed()) {
|
||||||
@ -89,7 +52,7 @@ class SmartyCollector extends DataCollector implements Renderable
|
|||||||
*/
|
*/
|
||||||
public function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return 'smarty';
|
return 'template_variables';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -101,14 +64,14 @@ class SmartyCollector extends DataCollector implements Renderable
|
|||||||
? "PhpDebugBar.Widgets.HtmlVariableListWidget"
|
? "PhpDebugBar.Widgets.HtmlVariableListWidget"
|
||||||
: "PhpDebugBar.Widgets.VariableListWidget";
|
: "PhpDebugBar.Widgets.VariableListWidget";
|
||||||
return [
|
return [
|
||||||
"smarty" => [
|
"template_variables" => [
|
||||||
"icon" => "file-text",
|
"icon" => "file-text",
|
||||||
"widget" => $widget,
|
"widget" => $widget,
|
||||||
"map" => "smarty.vars",
|
"map" => "template_variables.vars",
|
||||||
"default" => "{}",
|
"default" => "{}",
|
||||||
],
|
],
|
||||||
"smarty:badge" => [
|
"template_variables:badge" => [
|
||||||
"map" => "smarty.count",
|
"map" => "template_variables.count",
|
||||||
"default" => 0,
|
"default" => 0,
|
||||||
],
|
],
|
||||||
];
|
];
|
83
Application/Models/DebugBarHandler.php
Normal file
83
Application/Models/DebugBarHandler.php
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
use D3\DebugBar\Application\Component\DebugBarComponent;
|
||||||
|
use D3\DebugBar\Core\DebugBarErrorHandler;
|
||||||
|
use D3\DebugBar\Core\DebugBarExceptionHandler;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
|
class DebugBarHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setErrorHandler(): void
|
||||||
|
{
|
||||||
|
if (AvailabilityCheck::isAvailable()) {
|
||||||
|
/** @var callable $callable */
|
||||||
|
$callable = [
|
||||||
|
new DebugBarErrorHandler(),
|
||||||
|
'callback',
|
||||||
|
];
|
||||||
|
set_error_handler($callable, $this->getHandledErrorTypes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function getHandledErrorTypes(): int
|
||||||
|
{
|
||||||
|
return E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR | E_PARSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setExceptionHandler(): void
|
||||||
|
{
|
||||||
|
if (AvailabilityCheck::isAvailable()) {
|
||||||
|
set_exception_handler([
|
||||||
|
new DebugBarExceptionHandler(),
|
||||||
|
'handleUncaughtException',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addDebugBarComponent(): void
|
||||||
|
{
|
||||||
|
if (AvailabilityCheck::isAvailable()) {
|
||||||
|
$userComponentNames = Registry::getConfig()->getConfigParam('aUserComponentNames');
|
||||||
|
$d3CmpName = DebugBarComponent::class;
|
||||||
|
$blDontUseCache = 1;
|
||||||
|
|
||||||
|
if (! is_array($userComponentNames)) {
|
||||||
|
$userComponentNames = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! in_array($d3CmpName, array_keys($userComponentNames))) {
|
||||||
|
$userComponentNames[ $d3CmpName ] = $blDontUseCache;
|
||||||
|
Registry::getConfig()->setConfigParam('aUserComponentNames', $userComponentNames);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
Application/Models/Exceptions/CompileErrorException.php
Normal file
24
Application/Models/Exceptions/CompileErrorException.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Exceptions;
|
||||||
|
|
||||||
|
use ErrorException;
|
||||||
|
|
||||||
|
class CompileErrorException extends ErrorException
|
||||||
|
{
|
||||||
|
}
|
24
Application/Models/Exceptions/CoreErrorException.php
Normal file
24
Application/Models/Exceptions/CoreErrorException.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Exceptions;
|
||||||
|
|
||||||
|
use ErrorException;
|
||||||
|
|
||||||
|
class CoreErrorException extends ErrorException
|
||||||
|
{
|
||||||
|
}
|
24
Application/Models/Exceptions/ParseException.php
Normal file
24
Application/Models/Exceptions/ParseException.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Exceptions;
|
||||||
|
|
||||||
|
use ErrorException;
|
||||||
|
|
||||||
|
class ParseException extends ErrorException
|
||||||
|
{
|
||||||
|
}
|
24
Application/Models/Exceptions/UnavailableException.php
Normal file
24
Application/Models/Exceptions/UnavailableException.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Exceptions;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||||
|
|
||||||
|
class UnavailableException extends StandardException
|
||||||
|
{
|
||||||
|
}
|
24
Application/Models/Exceptions/UserErrorException.php
Normal file
24
Application/Models/Exceptions/UserErrorException.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Exceptions;
|
||||||
|
|
||||||
|
use ErrorException;
|
||||||
|
|
||||||
|
class UserErrorException extends ErrorException
|
||||||
|
{
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -19,8 +21,7 @@ use DebugBar\DataCollector\TimeDataCollector;
|
|||||||
|
|
||||||
class TimeDataCollectorHandler
|
class TimeDataCollectorHandler
|
||||||
{
|
{
|
||||||
/** @var TimeDataCollector */
|
private static TimeDataCollector|null $instance = null;
|
||||||
private static $instance = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return TimeDataCollector
|
* @return TimeDataCollector
|
||||||
|
28
Application/views/admin/de/debugbar_lang.php
Normal file
28
Application/views/admin/de/debugbar_lang.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
$sLangName = "Deutsch";
|
||||||
|
// -------------------------------
|
||||||
|
// RESOURCE IDENTITFIER = STRING
|
||||||
|
// -------------------------------
|
||||||
|
$aLang = [
|
||||||
|
|
||||||
|
//Navigation
|
||||||
|
'charset' => 'UTF-8',
|
||||||
|
'SHOP_MODULE_GROUP_d3debugbar_general' => 'Grundeinstellungen',
|
||||||
|
'SHOP_MODULE_d3debugbar_showForAdminUsersOnly' => 'DebugBar nur anzeigen, wenn angemeldeter Benutzer ein Adminbenutzer ist',
|
||||||
|
];
|
28
Application/views/admin/en/debugbar_lang.php
Normal file
28
Application/views/admin/en/debugbar_lang.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
$sLangName = "English";
|
||||||
|
// -------------------------------
|
||||||
|
// RESOURCE IDENTITFIER = STRING
|
||||||
|
// -------------------------------
|
||||||
|
$aLang = [
|
||||||
|
|
||||||
|
//Navigation
|
||||||
|
'charset' => 'UTF-8',
|
||||||
|
'SHOP_MODULE_GROUP_d3debugbar_general' => 'Default settings',
|
||||||
|
'SHOP_MODULE_d3debugbar_showForAdminUsersOnly' => 'show DebugBar only if logged in user is an admin user',
|
||||||
|
];
|
18
CHANGELOG.md
18
CHANGELOG.md
@ -4,7 +4,23 @@ 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/),
|
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).
|
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)
|
## [Unreleased](https://git.d3data.de/D3Public/DebugBar/compare/1.2.0.0...rel_1.x)
|
||||||
|
|
||||||
|
## [1.2.0.0](https://git.d3data.de/D3Public/DebugBar/compare/1.1.0.0...1.2.0.0) - 2023-01-03
|
||||||
|
### Added
|
||||||
|
- make installable in OXID 6.5.x (CE 6.12 + 6.13)
|
||||||
|
- collect unhandled exceptions, errors from Smarty and PHP
|
||||||
|
- show warning on activation if asset files doesn't exist
|
||||||
|
- catch all possible exceptions and errors
|
||||||
|
- add option to show DebugBar only if logged in user is an admin user
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- remove extra config item for current theme
|
||||||
|
- throw error exceptions on error levels only
|
||||||
|
- throw error type dependend exceptions
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- fix not existing component issue in admin panels login controller
|
||||||
|
|
||||||
## [1.1.0.0](https://git.d3data.de/D3Public/DebugBar/compare/1.0.0.0...1.1.0.0) - 2022-08-05
|
## [1.1.0.0](https://git.d3data.de/D3Public/DebugBar/compare/1.0.0.0...1.1.0.0) - 2022-08-05
|
||||||
### Added
|
### Added
|
||||||
|
100
Core/DebugBarErrorHandler.php
Normal file
100
Core/DebugBarErrorHandler.php
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Core;
|
||||||
|
|
||||||
|
use D3\DebugBar\Application\Models\AvailabilityCheck;
|
||||||
|
use D3\DebugBar\Application\Models\Exceptions\CompileErrorException;
|
||||||
|
use D3\DebugBar\Application\Models\Exceptions\CoreErrorException;
|
||||||
|
use D3\DebugBar\Application\Models\Exceptions\ParseException;
|
||||||
|
use D3\DebugBar\Application\Models\Exceptions\UserErrorException;
|
||||||
|
use ErrorException;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
|
class DebugBarErrorHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param int $severity
|
||||||
|
* @param string $message
|
||||||
|
* @param string $file
|
||||||
|
* @param int $line
|
||||||
|
*
|
||||||
|
* @return void|false
|
||||||
|
* @throws CompileErrorException
|
||||||
|
* @throws CoreErrorException
|
||||||
|
* @throws ErrorException
|
||||||
|
* @throws ParseException
|
||||||
|
* @throws UserErrorException
|
||||||
|
*/
|
||||||
|
public function callback(int $severity, string $message, string $file, int $line)
|
||||||
|
{
|
||||||
|
AvailabilityCheck::markErrorOccured();
|
||||||
|
|
||||||
|
if (0 === error_reporting() || !(error_reporting() & $severity)) {
|
||||||
|
// This error code is not included in error_reporting.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$smartyTemplate = $this->getSmartyTemplateLocationFromError($message);
|
||||||
|
if (is_array($smartyTemplate)) {
|
||||||
|
[ $file, $line ] = $smartyTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw match ($severity) {
|
||||||
|
E_CORE_ERROR => new CoreErrorException($message, 0, $severity, $file, $line),
|
||||||
|
E_COMPILE_ERROR => new CompileErrorException($message, 0, $severity, $file, $line),
|
||||||
|
E_USER_ERROR => new UserErrorException($message, 0, $severity, $file, $line),
|
||||||
|
E_PARSE => new ParseException($message, 0, $severity, $file, $line),
|
||||||
|
E_ERROR => new ErrorException($message, 0, $severity, $file, $line),
|
||||||
|
default => $this->handleUnregisteredErrorTypes($message, $severity, $file, $line),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $messsage
|
||||||
|
* @return array|null
|
||||||
|
*/
|
||||||
|
protected function getSmartyTemplateLocationFromError(string $messsage): ?array
|
||||||
|
{
|
||||||
|
if (stristr($messsage, 'Smarty error: [in ')) {
|
||||||
|
$start = strpos($messsage, '[') + 1;
|
||||||
|
$end = strpos($messsage, ']');
|
||||||
|
$parts = explode(' ', substr($messsage, $start, $end - $start));
|
||||||
|
return [Registry::getConfig()->getTemplateDir(isAdmin()).$parts[1], (int) $parts[3]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param int $severity
|
||||||
|
* @param string $file
|
||||||
|
* @param int $line
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws ErrorException
|
||||||
|
*/
|
||||||
|
protected function handleUnregisteredErrorTypes(
|
||||||
|
string $message = '',
|
||||||
|
int $severity = 1,
|
||||||
|
string $file = __FILE__,
|
||||||
|
int $line = __LINE__
|
||||||
|
): void {
|
||||||
|
throw new ErrorException($message, 0, $severity, $file, $line);
|
||||||
|
}
|
||||||
|
}
|
91
Core/DebugBarExceptionHandler.php
Normal file
91
Core/DebugBarExceptionHandler.php
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Core;
|
||||||
|
|
||||||
|
use D3\DebugBar\Application\Component\DebugBarComponent;
|
||||||
|
use D3\DebugBar\Application\Models\AvailabilityCheck;
|
||||||
|
use D3\DebugBar\Application\Models\Exceptions\UnavailableException;
|
||||||
|
use DebugBar\DataCollector\ExceptionsCollector;
|
||||||
|
use DebugBar\DebugBarException;
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Logger\LoggerServiceFactory;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Transition\Utility\Context;
|
||||||
|
use ReflectionException;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class DebugBarExceptionHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handler for uncaught exceptions.
|
||||||
|
*
|
||||||
|
* @param Throwable $exception exception object
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
|
public function handleUncaughtException(Throwable $exception): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Registry::getLogger()->error(
|
||||||
|
$exception->getMessage(),
|
||||||
|
[$exception]
|
||||||
|
);
|
||||||
|
} catch (Throwable) {
|
||||||
|
/**
|
||||||
|
* It's not possible to get the logger from the DI container.
|
||||||
|
* Try again to log original exception (without DI container) in order to show the root cause of a problem.
|
||||||
|
*/
|
||||||
|
$loggerServiceFactory = new LoggerServiceFactory(new Context());
|
||||||
|
$logger = $loggerServiceFactory->getLogger();
|
||||||
|
$logger->error($exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AvailabilityCheck::isAvailable() && AvailabilityCheck::ifDebugBarNotSet()) {
|
||||||
|
try {
|
||||||
|
/** @var DebugBarComponent $debugBarComponent */
|
||||||
|
$debugBarComponent = oxNew(DebugBarComponent::class);
|
||||||
|
|
||||||
|
/** @var ExceptionsCollector $excCollector */
|
||||||
|
$excCollector = $debugBarComponent->getDebugBar()->getCollector('exceptions');
|
||||||
|
$excCollector->addThrowable($exception);
|
||||||
|
|
||||||
|
echo <<<HTML
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title></title>
|
||||||
|
HTML;
|
||||||
|
echo $debugBarComponent->getRenderer()->renderHead();
|
||||||
|
$debugBarComponent->addTimelineMeasures();
|
||||||
|
echo <<<HTML
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
HTML;
|
||||||
|
AvailabilityCheck::markDebugBarAsSet();
|
||||||
|
echo $debugBarComponent->getRenderer()->render();
|
||||||
|
echo <<<HTML
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
HTML;
|
||||||
|
} catch (DebugBarException|UnavailableException $e) {
|
||||||
|
Registry::getLogger()->error($e->getMessage());
|
||||||
|
Registry::getUtilsView()->addErrorToDisplay($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -16,6 +18,11 @@ declare(strict_types=1);
|
|||||||
namespace D3\DebugBar\Modules\Core {
|
namespace D3\DebugBar\Modules\Core {
|
||||||
|
|
||||||
use OxidEsales\Eshop\Core\ShopControl;
|
use OxidEsales\Eshop\Core\ShopControl;
|
||||||
|
use OxidEsales\EshopCommunity\Core\Config;
|
||||||
|
|
||||||
|
class Config_DebugBar_parent extends Config
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class ShopControl_DebugBar_parent extends ShopControl
|
class ShopControl_DebugBar_parent extends ShopControl
|
||||||
{
|
{
|
||||||
|
37
Modules/Core/Config_DebugBar.php
Normal file
37
Modules/Core/Config_DebugBar.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Modules\Core;
|
||||||
|
|
||||||
|
use D3\DebugBar\Application\Models\AvailabilityCheck;
|
||||||
|
use D3\DebugBar\Core\DebugBarExceptionHandler;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\ExceptionHandler;
|
||||||
|
|
||||||
|
class Config_DebugBar extends Config_DebugBar_parent
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return DebugBarExceptionHandler|ExceptionHandler
|
||||||
|
*/
|
||||||
|
protected function getExceptionHandler()
|
||||||
|
{
|
||||||
|
if (AvailabilityCheck::isAvailable()) {
|
||||||
|
return new DebugBarExceptionHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::getExceptionHandler();
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -16,49 +18,95 @@ declare(strict_types=1);
|
|||||||
namespace D3\DebugBar\Modules\Core;
|
namespace D3\DebugBar\Modules\Core;
|
||||||
|
|
||||||
use D3\DebugBar\Application\Component\DebugBarComponent;
|
use D3\DebugBar\Application\Component\DebugBarComponent;
|
||||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
use D3\DebugBar\Application\Models\AvailabilityCheck;
|
||||||
|
use D3\DebugBar\Application\Models\DebugBarHandler;
|
||||||
|
use D3\DebugBar\Application\Models\Exceptions\UnavailableException;
|
||||||
|
use D3\DebugBar\Core\DebugBarExceptionHandler;
|
||||||
|
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use ReflectionException;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class ShopControl_DebugBar extends ShopControl_DebugBar_parent
|
class ShopControl_DebugBar extends ShopControl_DebugBar_parent
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->_d3AddDebugBarComponent();
|
$handler = oxNew(DebugBarHandler::class);
|
||||||
|
|
||||||
|
$handler->setErrorHandler();
|
||||||
|
$handler->setExceptionHandler();
|
||||||
|
$handler->addDebugBarComponent();
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @param string|null $controllerKey
|
||||||
|
* @param string|null $function
|
||||||
|
* @param array|null $parameters
|
||||||
|
* @param array|null $viewsChain
|
||||||
|
*
|
||||||
|
* @throws UnavailableException
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
protected function _d3AddDebugBarComponent(): void
|
public function start($controllerKey = null, $function = null, $parameters = null, $viewsChain = null)
|
||||||
{
|
{
|
||||||
$userComponentNames = Registry::getConfig()->getConfigParam('aUserComponentNames');
|
parent::start();
|
||||||
$d3CmpName = DebugBarComponent::class;
|
|
||||||
$blDontUseCache = 1;
|
|
||||||
|
|
||||||
if (!is_array($userComponentNames)) {
|
if (AvailabilityCheck::isAvailable() && AvailabilityCheck::ifDebugBarNotSet() && AvailabilityCheck::ifNoErrorOccured()) {
|
||||||
$userComponentNames = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array($d3CmpName, array_keys($userComponentNames))) {
|
|
||||||
$userComponentNames[$d3CmpName] = $blDontUseCache;
|
|
||||||
Registry::getConfig()->setConfigParam('aUserComponentNames', $userComponentNames);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __destruct()
|
|
||||||
{
|
|
||||||
if (!isAdmin()) {
|
|
||||||
/** @var FrontendController $activeView */
|
|
||||||
$activeView = Registry::getConfig()->getTopActiveView();
|
$activeView = Registry::getConfig()->getTopActiveView();
|
||||||
/** @var DebugBarComponent|null $debugBarComponent */
|
/** @var DebugBarComponent|null $debugBarComponent */
|
||||||
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class);
|
$debugBarComponent = method_exists($activeView, 'getComponent')
|
||||||
|
? $activeView->getComponent(DebugBarComponent::class)
|
||||||
|
: null;
|
||||||
if ($debugBarComponent) {
|
if ($debugBarComponent) {
|
||||||
|
AvailabilityCheck::markDebugBarAsSet();
|
||||||
echo $debugBarComponent->getRenderer()->renderHead();
|
echo $debugBarComponent->getRenderer()->renderHead();
|
||||||
$debugBarComponent->addTimelineMessures();
|
$debugBarComponent->addTimelineMeasures();
|
||||||
echo $debugBarComponent->getRenderer()->render();
|
echo $debugBarComponent->getRenderer()->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Throwable $exception
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
|
protected function debugBarHandleException(Throwable $exception): void
|
||||||
|
{
|
||||||
|
$exceptionHandler = new DebugBarExceptionHandler();
|
||||||
|
$exceptionHandler->handleUncaughtException($exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param StandardException $exception
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
|
protected function _handleSystemException($exception)
|
||||||
|
{
|
||||||
|
$this->debugBarHandleException($exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param StandardException $exception
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
|
protected function _handleCookieException($exception)
|
||||||
|
{
|
||||||
|
$this->debugBarHandleException($exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param StandardException $exception
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
|
protected function _handleBaseException($exception)
|
||||||
|
{
|
||||||
|
$this->debugBarHandleException($exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -14,13 +16,16 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use D3\DebugBar\Application\Component\DebugBarComponent;
|
use D3\DebugBar\Application\Component\DebugBarComponent;
|
||||||
|
use D3\DebugBar\Application\Models\AvailabilityCheck;
|
||||||
|
use D3\DebugBar\Application\Models\Exceptions\UnavailableException;
|
||||||
use D3\DebugBar\Application\Models\TimeDataCollectorHandler;
|
use D3\DebugBar\Application\Models\TimeDataCollectorHandler;
|
||||||
use DebugBar\DataCollector\MessagesCollector;
|
use DebugBar\DataCollector\MessagesCollector;
|
||||||
use DebugBar\DebugBarException;
|
use DebugBar\DebugBarException;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $sProfileName
|
* @param string $sProfileName
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function startProfile(string $sProfileName): void
|
function startProfile(string $sProfileName): void
|
||||||
@ -59,7 +64,6 @@ function stopProfile(string $sProfileName): void
|
|||||||
$timeDataCollector = TimeDataCollectorHandler::getInstance();
|
$timeDataCollector = TimeDataCollectorHandler::getInstance();
|
||||||
$timeDataCollector->stopMeasure($hash);
|
$timeDataCollector->stopMeasure($hash);
|
||||||
|
|
||||||
|
|
||||||
global $aStartTimes;
|
global $aStartTimes;
|
||||||
global $executionCounts;
|
global $executionCounts;
|
||||||
if (!isset($executionCounts[$sProfileName])) {
|
if (!isset($executionCounts[$sProfileName])) {
|
||||||
@ -79,7 +83,7 @@ function stopProfile(string $sProfileName): void
|
|||||||
* @throws DebugBarException
|
* @throws DebugBarException
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function debugVar($mVar, bool $blToFile = false): void
|
function debugVar(mixed $mVar, bool $blToFile = false): void
|
||||||
{
|
{
|
||||||
if ($blToFile) {
|
if ($blToFile) {
|
||||||
$out = var_export($mVar, true);
|
$out = var_export($mVar, true);
|
||||||
@ -89,17 +93,24 @@ function debugVar($mVar, bool $blToFile = false): void
|
|||||||
fclose($f);
|
fclose($f);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isAdmin()) {
|
try {
|
||||||
|
if (! AvailabilityCheck::isAvailable()) {
|
||||||
|
throw new UnavailableException();
|
||||||
|
}
|
||||||
$activeView = Registry::getConfig()->getTopActiveView();
|
$activeView = Registry::getConfig()->getTopActiveView();
|
||||||
/** @var DebugBarComponent $debugBarComponent */
|
/** @var DebugBarComponent|null $debugBarComponent */
|
||||||
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class);
|
$debugBarComponent = method_exists($activeView, 'getComponent')
|
||||||
|
? $activeView->getComponent(DebugBarComponent::class)
|
||||||
|
: null;
|
||||||
|
if ($debugBarComponent === null) {
|
||||||
|
throw new UnavailableException();
|
||||||
|
}
|
||||||
/** @var MessagesCollector $messages */
|
/** @var MessagesCollector $messages */
|
||||||
$messages = $debugBarComponent->getDebugBar()->getCollector('messages');
|
$messages = $debugBarComponent->getDebugBar()->getCollector('messages');
|
||||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||||
//$location = $trace[1]['class'] . '::' . $trace[1]['function']. '(' . $trace[0]['line'] . ')';
|
|
||||||
$location = $trace[1]['class'] . '::' . $trace[1]['function'];
|
$location = $trace[1]['class'] . '::' . $trace[1]['function'];
|
||||||
$messages->addMessage($mVar, $location);
|
$messages->addMessage($mVar, $location);
|
||||||
} else {
|
} catch (UnavailableException) {
|
||||||
dumpVar($mVar, $blToFile);
|
dumpVar($mVar, $blToFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
README.en.md
26
README.en.md
@ -1,3 +1,7 @@
|
|||||||
|

|
||||||
|
[](https://packagist.org/packages/d3/oxid-debugbar)
|
||||||
|

|
||||||
|
|
||||||
[](README.md)
|
[](README.md)
|
||||||
[](README.en.md)
|
[](README.en.md)
|
||||||
|
|
||||||
@ -5,7 +9,7 @@
|
|||||||
|
|
||||||
The debug bar enables the display of relevant debug information in the shop frontend.
|
The debug bar enables the display of relevant debug information in the shop frontend.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Table of content
|
## Table of content
|
||||||
|
|
||||||
@ -25,14 +29,14 @@ Please enter the following section in the `composer.json` of your project:
|
|||||||
```
|
```
|
||||||
"extra": {
|
"extra": {
|
||||||
"ajgl-symlinks": {
|
"ajgl-symlinks": {
|
||||||
"maximebf/debugbar": {
|
"php-debugbar/php-debugbar": {
|
||||||
"src/DebugBar/Resources": "source/out/debugbar"
|
"src/DebugBar/Resources": "source/out/debugbar"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enable-patching": "true",
|
"enable-patching": "true",
|
||||||
"patches": {
|
"patches": {
|
||||||
"oxid-esales/oxideshop-ce": {
|
"oxid-esales/oxideshop-ce": {
|
||||||
"Add overridable functions for advanced profiling in Debug Bar": "https://git.d3data.de/D3Public/DebugBar/raw/branch/patches/overridablefunctions.patch"
|
"Add overridable functions for advanced profiling in Debug Bar": "https://git.d3data.de/D3Public/DebugBar/raw/branch/patches/overridablefunctions_2.0.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,16 +45,24 @@ 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.
|
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
|
```bash
|
||||||
php composer require d3/oxid-debugbar:^1.0
|
php composer require d3/oxid-debugbar:^2.0
|
||||||
```
|
```
|
||||||
|
|
||||||
If necessary, please confirm that you allow `composer-symlinker` and `composer-patches` to execute code.
|
If necessary, please confirm that you allow `composer-symlinker` and `composer-patches` to execute code.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -rf vendor/oxid-esales/oxideshop-ce
|
||||||
|
php composer install
|
||||||
|
php composer update --lock
|
||||||
|
```
|
||||||
|
|
||||||
|
Have the files of the package `oxid-esales/oxideshop-ce` overwritten.
|
||||||
|
|
||||||
Activate the module in Shopadmin under "Extensions -> Modules".
|
Activate the module in Shopadmin under "Extensions -> Modules".
|
||||||
|
|
||||||
## How to use
|
## 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.__
|
__Please note that the DebugBar contains security-relevant information. It should therefore never be activated in a public installation__.
|
||||||
|
|
||||||
The DebugBar displays the following tabs:
|
The DebugBar displays the following tabs:
|
||||||
- Messages
|
- Messages
|
||||||
@ -63,8 +75,10 @@ The DebugBar displays the following tabs:
|
|||||||
shows basic shop information (edition, versions, theme information)
|
shows basic shop information (edition, versions, theme information)
|
||||||
- Configuration
|
- Configuration
|
||||||
provides all configuration settings of the shop from database and config files
|
provides all configuration settings of the shop from database and config files
|
||||||
- Smarty
|
- Template variables
|
||||||
lists all variables of the template engine that are available on the current shop page
|
lists all variables of the template engine that are available on the current shop page
|
||||||
|
- Twig
|
||||||
|
shows Twig internal profiling (only when using the Twig Template Engine)
|
||||||
- Monolog
|
- Monolog
|
||||||
lists all log messages passed to the Monolog Logger
|
lists all log messages passed to the Monolog Logger
|
||||||
- Database
|
- Database
|
||||||
|
24
README.md
24
README.md
@ -1,3 +1,7 @@
|
|||||||
|

|
||||||
|
[](https://packagist.org/packages/d3/oxid-debugbar)
|
||||||
|

|
||||||
|
|
||||||
[](README.md)
|
[](README.md)
|
||||||
[](README.en.md)
|
[](README.en.md)
|
||||||
|
|
||||||
@ -5,7 +9,7 @@
|
|||||||
|
|
||||||
Die Debug Bar ermöglicht die Darstellung relevanter Debuginformationen im Shopfrontend.
|
Die Debug Bar ermöglicht die Darstellung relevanter Debuginformationen im Shopfrontend.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Inhaltsverzeichnis
|
## Inhaltsverzeichnis
|
||||||
|
|
||||||
@ -25,14 +29,14 @@ Bitte tragen Sie den folgenden Abschnitt in die `composer.json` Ihres Projektes
|
|||||||
```
|
```
|
||||||
"extra": {
|
"extra": {
|
||||||
"ajgl-symlinks": {
|
"ajgl-symlinks": {
|
||||||
"maximebf/debugbar": {
|
"php-debugbar/php-debugbar": {
|
||||||
"src/DebugBar/Resources": "source/out/debugbar"
|
"src/DebugBar/Resources": "source/out/debugbar"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"enable-patching": "true",
|
"enable-patching": "true",
|
||||||
"patches": {
|
"patches": {
|
||||||
"oxid-esales/oxideshop-ce": {
|
"oxid-esales/oxideshop-ce": {
|
||||||
"Add overridable functions for advanced profiling in Debug Bar": "https://git.d3data.de/D3Public/DebugBar/raw/branch/patches/overridablefunctions.patch"
|
"Add overridable functions for advanced profiling in Debug Bar": "https://git.d3data.de/D3Public/DebugBar/raw/branch/patches/overridablefunctions_2.0.patch"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,11 +45,19 @@ 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.
|
Ă–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
|
```bash
|
||||||
php composer require d3/oxid-debugbar:^1.0
|
php composer require d3/oxid-debugbar:^2.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Sofern nötig, bestätigen Sie bitte, dass Sie `composer-symlinker` und `composer-patches` erlauben, Code auszuführen.
|
Sofern nötig, bestätigen Sie bitte, dass Sie `composer-symlinker` und `composer-patches` erlauben, Code auszuführen.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -rf vendor/oxid-esales/oxideshop-ce
|
||||||
|
php composer install
|
||||||
|
php composer update --lock
|
||||||
|
```
|
||||||
|
|
||||||
|
Lassen Sie die Dateien des Paketes `oxid-esales/oxideshop-ce` ĂĽberschreiben.
|
||||||
|
|
||||||
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||||
|
|
||||||
## Verwendung
|
## Verwendung
|
||||||
@ -63,8 +75,10 @@ Die DebugBar stellt folgende Tabs dar:
|
|||||||
zeigt grundlegende Shopinformationen (Edition, Versionen, Themeinformationen)
|
zeigt grundlegende Shopinformationen (Edition, Versionen, Themeinformationen)
|
||||||
- Configuration
|
- Configuration
|
||||||
stellt alle Konfigurationseinstellungen des Shops aus Datenbank und config-Dateien zur VerfĂĽgung
|
stellt alle Konfigurationseinstellungen des Shops aus Datenbank und config-Dateien zur VerfĂĽgung
|
||||||
- Smarty
|
- Template Variablen
|
||||||
listet alle Variablen der Template-Engine, die auf der aktuellen Shopseite zur VerfĂĽgung stehen
|
listet alle Variablen der Template-Engine, die auf der aktuellen Shopseite zur VerfĂĽgung stehen
|
||||||
|
- Twig
|
||||||
|
zeigt Twig internes Profiling (nur bei Verwendung der Twig Template Engine)
|
||||||
- Monolog
|
- Monolog
|
||||||
listet alle an den Monolog Logger ĂĽbergebenen Lognachrichten
|
listet alle an den Monolog Logger ĂĽbergebenen Lognachrichten
|
||||||
- Database
|
- Database
|
||||||
|
48
Setup/Events.php
Normal file
48
Setup/Events.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* 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\Setup;
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
|
||||||
|
class Events
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function onActivate(): void
|
||||||
|
{
|
||||||
|
/** @var string $shopDir */
|
||||||
|
$shopDir = Registry::getConfig()->getConfigParam('sShopDir');
|
||||||
|
if (false === file_exists(
|
||||||
|
rtrim($shopDir, '/').'/out/debugbar/debugbar.js'
|
||||||
|
)) {
|
||||||
|
Registry::getUtilsView()->addErrorToDisplay(
|
||||||
|
'The asset files cannot be found. Have you forgotten an installation step described in <a href="https://git.d3data.de/D3Public/DebugBar/src/branch/main/README.en.md">README</a>? Then please run the installation again.'.
|
||||||
|
nl2br(PHP_EOL.PHP_EOL).
|
||||||
|
'Die Assetdateien können nicht gefunden werden. Hast Du einen Installationsschritt vergessen, der in <a href="https://git.d3data.de/D3Public/DebugBar/src/branch/main/README.md">README</a> beschrieben ist? Dann führe die Installation bitte noch einmal aus.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function onDeactivate(): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
3
ToDo.md
3
ToDo.md
@ -1,5 +1,4 @@
|
|||||||
# ToDo
|
# ToDo
|
||||||
|
|
||||||
- clear tmp button
|
- clear tpl cache button
|
||||||
- phpinfo() overview
|
- phpinfo() overview
|
||||||
- automatic switch between Smarty and Twig
|
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "d3/oxid-debugbar",
|
"name": "d3/oxid-debugbar",
|
||||||
"description": "add the DegugBar to OXID eShop",
|
"description": "add the DebugBar to OXID eShop",
|
||||||
"type": "oxideshop-module",
|
"type": "oxideshop-module",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"oxid",
|
"oxid",
|
||||||
@ -25,34 +25,23 @@
|
|||||||
"GPL-3.0-or-later"
|
"GPL-3.0-or-later"
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.3",
|
"php": "^8.0",
|
||||||
"oxid-esales/oxideshop-ce": "6.8 - 6.10",
|
"oxid-esales/oxideshop-ce": "7.0 - 7.2",
|
||||||
"maximebf/debugbar": "^1.18",
|
"php-debugbar/php-debugbar": "^2.1.6",
|
||||||
"ajgl/composer-symlinker": "^0.3.1",
|
"ajgl/composer-symlinker": "^0.3.1",
|
||||||
"cweagans/composer-patches": "^1.7.2"
|
"cweagans/composer-patches": "^1.7.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"php": "^7.4",
|
|
||||||
"phpunit/phpunit" : "^9.5",
|
"phpunit/phpunit" : "^9.5",
|
||||||
"friendsofphp/php-cs-fixer": "^3.9",
|
"friendsofphp/php-cs-fixer": "^3.9",
|
||||||
"phpstan/phpstan": "^1.8"
|
"phpstan/phpstan": "^1.8"
|
||||||
},
|
},
|
||||||
"extra": {
|
|
||||||
"oxideshop": {
|
|
||||||
"blacklist-filter": [
|
|
||||||
"*.md",
|
|
||||||
"composer.json",
|
|
||||||
".php-cs-fixer.php",
|
|
||||||
"*.xml",
|
|
||||||
"*.neon",
|
|
||||||
"*.jpg"
|
|
||||||
],
|
|
||||||
"target-directory": "d3/debugbar"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"D3\\DebugBar\\": "../../../source/modules/d3/debugbar"
|
"D3\\DebugBar\\": ""
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"php-cs-fixer": "./vendor/bin/php-cs-fixer fix --config=vendor/d3/oxid-debugbar/.php-cs-fixer.php"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
27
metadata.php
27
metadata.php
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -13,34 +15,45 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use D3\DebugBar\Modules\Core\Config_DebugBar;
|
||||||
use D3\DebugBar\Modules\Core\ShopControl_DebugBar;
|
use D3\DebugBar\Modules\Core\ShopControl_DebugBar;
|
||||||
|
use OxidEsales\Eshop\Core\Config;
|
||||||
use OxidEsales\Eshop\Core\ShopControl;
|
use OxidEsales\Eshop\Core\ShopControl;
|
||||||
|
|
||||||
$sMetadataVersion = '2.1';
|
$sMetadataVersion = '2.1';
|
||||||
|
|
||||||
$sModuleId = 'd3debugbar';
|
$sModuleId = 'd3debugbar';
|
||||||
$logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em">';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module information
|
* Module information
|
||||||
*/
|
*/
|
||||||
$aModule = [
|
$aModule = [
|
||||||
'id' => $sModuleId,
|
'id' => $sModuleId,
|
||||||
'title' => $logo.' DebugBar',
|
'title' => '(D3) DebugBar',
|
||||||
'description' => [
|
'description' => [
|
||||||
'de' => '',
|
'de' => '',
|
||||||
'en' => '',
|
'en' => '',
|
||||||
],
|
],
|
||||||
'version' => '1.0.0.0',
|
'version' => '1.2.0.0',
|
||||||
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
'author' => 'D³ Data Development (Inh.: Thomas Dartsch)',
|
||||||
'email' => 'support@shopmodule.com',
|
'email' => 'support@shopmodule.com',
|
||||||
'url' => 'https://www.oxidmodule.com/',
|
'url' => 'https://www.oxidmodule.com/',
|
||||||
'controllers' => [],
|
'controllers' => [],
|
||||||
'extend' => [
|
'extend' => [
|
||||||
|
Config::class => Config_DebugBar::class,
|
||||||
ShopControl::class => ShopControl_DebugBar::class,
|
ShopControl::class => ShopControl_DebugBar::class,
|
||||||
],
|
],
|
||||||
'events' => [],
|
'events' => [
|
||||||
|
'onActivate' => '\D3\DebugBar\Setup\Events::onActivate',
|
||||||
|
],
|
||||||
'templates' => [],
|
'templates' => [],
|
||||||
'settings' => [],
|
'settings' => [
|
||||||
|
[
|
||||||
|
'group' => $sModuleId.'_general',
|
||||||
|
'name' => $sModuleId.'_showForAdminUsersOnly',
|
||||||
|
'type' => 'bool',
|
||||||
|
'value' => false,
|
||||||
|
],
|
||||||
|
],
|
||||||
'blocks' => [],
|
'blocks' => [],
|
||||||
];
|
];
|
||||||
|
@ -10,3 +10,7 @@ parameters:
|
|||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
- '#setConfigParam\(\) expects string, array given.#'
|
- '#setConfigParam\(\) expects string, array given.#'
|
||||||
- '#Offset .* does not exist on array{function: .*}.#'
|
- '#Offset .* does not exist on array{function: .*}.#'
|
||||||
|
- '#ShopControl_DebugBar::_handle.*Exception\(\) has no return type specified#'
|
||||||
|
- '#ShopControl_DebugBar::start\(\) has no return type specified.#'
|
||||||
|
- '#UtilsView::addErrorToDisplay\(\) expects OxidEsales\\Eshop\\Core\\Contract\\IDisplayError#'
|
||||||
|
- '#PHPDoc tag @throws with type .*\\ContainerExceptionInterface is not subtype of Throwable#'
|
||||||
|
BIN
screenshot.jpg
BIN
screenshot.jpg
Binary file not shown.
Before Width: | Height: | Size: 71 KiB |
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
@ -5,5 +5,13 @@ services:
|
|||||||
|
|
||||||
Psr\Log\LoggerInterface:
|
Psr\Log\LoggerInterface:
|
||||||
class: Monolog\Logger
|
class: Monolog\Logger
|
||||||
factory: 'OxidEsales\EshopCommunity\Internal\Framework\Logger\Factory\LoggerFactoryInterface:create'
|
factory: ['@OxidEsales\EshopCommunity\Internal\Framework\Logger\Factory\LoggerFactoryInterface', 'create']
|
||||||
public: true
|
public: true
|
||||||
|
|
||||||
|
Twig\Profiler\Profile:
|
||||||
|
class: Twig\Profiler\Profile
|
||||||
|
public: true
|
||||||
|
shared: true
|
||||||
|
|
||||||
|
Twig\Extension\ProfilerExtension:
|
||||||
|
tags: [ 'twig.extension' ]
|
Reference in New Issue
Block a user