Compare commits
No commits in common. "main" and "1.1.0.0" have entirely different histories.
@ -15,16 +15,13 @@ 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\SmartyCollector;
|
||||||
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\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;
|
||||||
@ -45,8 +42,8 @@ use ReflectionException;
|
|||||||
|
|
||||||
class DebugBarComponent extends BaseController
|
class DebugBarComponent extends BaseController
|
||||||
{
|
{
|
||||||
/** @var DebugBar|null */
|
/** @var DebugBar */
|
||||||
protected $debugBar = null;
|
protected $debugBar;
|
||||||
/** @var JavascriptRenderer */
|
/** @var JavascriptRenderer */
|
||||||
protected $debugBarRenderer;
|
protected $debugBarRenderer;
|
||||||
|
|
||||||
@ -65,7 +62,7 @@ class DebugBarComponent extends BaseController
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
if (AvailabilityCheck::isAvailable()) {
|
if (false === isAdmin()) {
|
||||||
$debugbar = new DebugBar();
|
$debugbar = new DebugBar();
|
||||||
|
|
||||||
$this->addCollectors($debugbar);
|
$this->addCollectors($debugbar);
|
||||||
@ -166,7 +163,6 @@ 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());
|
||||||
@ -182,10 +178,6 @@ class DebugBarComponent extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function addTimelineMessures(): void
|
public function addTimelineMessures(): 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();
|
||||||
|
|
||||||
@ -197,14 +189,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,83 +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;
|
|
||||||
|
|
||||||
use OxidEsales\Eshop\Application\Model\User;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
|
||||||
|
|
||||||
class AvailabilityCheck
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public static function isAvailable(): bool
|
|
||||||
{
|
|
||||||
return !isAdmin() && (
|
|
||||||
Registry::getConfig()->getShopConfVar('d3debugbar_showForAdminUsersOnly') != true ||
|
|
||||||
self::userIsMallAdmin()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -36,11 +36,6 @@ class OxidConfigCollector extends DataCollector implements Renderable
|
|||||||
*/
|
*/
|
||||||
protected $useHtmlVarDumper = false;
|
protected $useHtmlVarDumper = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Config $config
|
|
||||||
*
|
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
|
||||||
public function __construct(Config $config)
|
public function __construct(Config $config)
|
||||||
{
|
{
|
||||||
$config->init();
|
$config->init();
|
||||||
@ -116,9 +111,9 @@ class OxidConfigCollector extends DataCollector implements Renderable
|
|||||||
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
|
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
|
||||||
* rendering.
|
* rendering.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function isHtmlVarDumperUsed(): bool
|
public function isHtmlVarDumperUsed()
|
||||||
{
|
{
|
||||||
return $this->useHtmlVarDumper;
|
return $this->useHtmlVarDumper;
|
||||||
}
|
}
|
||||||
|
@ -18,17 +18,13 @@ 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\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\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
|
||||||
{
|
{
|
||||||
@ -43,18 +39,11 @@ class OxidShopCollector extends DataCollector implements Renderable
|
|||||||
*/
|
*/
|
||||||
protected $useHtmlVarDumper = true;
|
protected $useHtmlVarDumper = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws ContainerExceptionInterface
|
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$facts = new Facts();
|
$facts = new Facts();
|
||||||
$theme = new Theme();
|
$theme = new Theme();
|
||||||
/** @var Theme|null $parent */
|
$parentThemeId = $theme->getParent() ? $theme->getParent()->getId() : '--';
|
||||||
$parent = $theme->getParent();
|
|
||||||
$parentThemeId = $parent ? $parent->getId() : '--';
|
|
||||||
|
|
||||||
$moduleList = $this->getInstalledModules();
|
$moduleList = $this->getInstalledModules();
|
||||||
array_walk(
|
array_walk(
|
||||||
@ -71,7 +60,7 @@ 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:' => implode(chr(10), $moduleList)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,9 +96,9 @@ class OxidShopCollector extends DataCollector implements Renderable
|
|||||||
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
|
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
|
||||||
* rendering.
|
* rendering.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function isHtmlVarDumperUsed(): bool
|
public function isHtmlVarDumperUsed()
|
||||||
{
|
{
|
||||||
return $this->useHtmlVarDumper;
|
return $this->useHtmlVarDumper;
|
||||||
}
|
}
|
||||||
@ -132,17 +121,10 @@ class OxidShopCollector extends DataCollector implements Renderable
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
* @throws ContainerExceptionInterface
|
|
||||||
* @throws NotFoundExceptionInterface
|
|
||||||
*/
|
|
||||||
protected function getInstalledModules(): array
|
protected function getInstalledModules(): array
|
||||||
{
|
{
|
||||||
$container = ContainerFactory::getInstance()->getContainer();
|
$container = ContainerFactory::getInstance()->getContainer();
|
||||||
/** @var ShopConfigurationDaoBridge $shopConfigurationDaoBridge */
|
$shopConfiguration = $container->get(ShopConfigurationDaoBridgeInterface::class)->get();
|
||||||
$shopConfigurationDaoBridge = $container->get(ShopConfigurationDaoBridgeInterface::class);
|
|
||||||
$shopConfiguration = $shopConfigurationDaoBridge->get();
|
|
||||||
|
|
||||||
$modules = [];
|
$modules = [];
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
@ -17,8 +16,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,35 +28,38 @@ class OxidVersionCollector extends DataCollector implements Renderable
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName(): string
|
public function getName()
|
||||||
{
|
{
|
||||||
return 'oxidversion';
|
return 'oxidversion';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function collect(): array
|
public function collect()
|
||||||
{
|
{
|
||||||
$facts = new Facts();
|
$facts = new Facts();
|
||||||
|
$theme = new Theme();
|
||||||
|
$parentThemeId = $theme->getParent() ? $theme->getParent()->getId() : '--';
|
||||||
|
|
||||||
return [
|
return array(
|
||||||
'version' => $facts->getEdition().' '.ShopVersion::getVersion(),
|
'version' => $facts->getEdition().' '.ShopVersion::getVersion()
|
||||||
];
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string[][]
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public function getWidgets(): array
|
public function getWidgets()
|
||||||
{
|
{
|
||||||
|
$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" => ""
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class SmartyCollector extends DataCollector implements Renderable
|
|||||||
* @param bool $value
|
* @param bool $value
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function useHtmlVarDumper(bool $value = true): SmartyCollector
|
public function useHtmlVarDumper($value = true)
|
||||||
{
|
{
|
||||||
$this->useHtmlVarDumper = $value;
|
$this->useHtmlVarDumper = $value;
|
||||||
|
|
||||||
@ -49,9 +49,9 @@ class SmartyCollector extends DataCollector implements Renderable
|
|||||||
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
|
* Indicates whether the Symfony HtmlDumper will be used to dump variables for rich variable
|
||||||
* rendering.
|
* rendering.
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function isHtmlVarDumperUsed(): bool
|
public function isHtmlVarDumperUsed()
|
||||||
{
|
{
|
||||||
return $this->useHtmlVarDumper;
|
return $this->useHtmlVarDumper;
|
||||||
}
|
}
|
||||||
|
@ -1,81 +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;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +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\Exceptions;
|
|
||||||
|
|
||||||
use ErrorException;
|
|
||||||
|
|
||||||
class CompileErrorException extends ErrorException
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,22 +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\Exceptions;
|
|
||||||
|
|
||||||
use ErrorException;
|
|
||||||
|
|
||||||
class CoreErrorException extends ErrorException
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,22 +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\Exceptions;
|
|
||||||
|
|
||||||
use ErrorException;
|
|
||||||
|
|
||||||
class ParseException extends ErrorException
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,22 +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\Exceptions;
|
|
||||||
|
|
||||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
|
||||||
|
|
||||||
class UnavailableException extends StandardException
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,22 +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\Exceptions;
|
|
||||||
|
|
||||||
use ErrorException;
|
|
||||||
|
|
||||||
class UserErrorException extends ErrorException
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,26 +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);
|
|
||||||
|
|
||||||
$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',
|
|
||||||
];
|
|
@ -1,26 +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);
|
|
||||||
|
|
||||||
$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,23 +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/),
|
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.2.0.0...rel_1.x)
|
## [Unreleased](https://git.d3data.de/D3Public/DebugBar/compare/1.1.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
|
||||||
|
@ -1,104 +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\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;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($severity) {
|
|
||||||
case E_CORE_ERROR:
|
|
||||||
throw new CoreErrorException($message, 0, $severity, $file, $line);
|
|
||||||
case E_COMPILE_ERROR:
|
|
||||||
throw new CompileErrorException($message, 0, $severity, $file, $line);
|
|
||||||
case E_USER_ERROR:
|
|
||||||
throw new UserErrorException($message, 0, $severity, $file, $line);
|
|
||||||
case E_PARSE:
|
|
||||||
throw new ParseException($message, 0, $severity, $file, $line);
|
|
||||||
case E_ERROR:
|
|
||||||
throw 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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,92 +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\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\ConfigFile;
|
|
||||||
use OxidEsales\Eshop\Core\Exception\ExceptionHandler;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Logger\LoggerServiceFactory;
|
|
||||||
use OxidEsales\EshopCommunity\Internal\Transition\Utility\Context;
|
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class DebugBarExceptionHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Handler for uncaught exceptions.
|
|
||||||
*
|
|
||||||
* @param Throwable $exception exception object
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function handleUncaughtException(Throwable $exception): void
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
/** @var int $debugMode */
|
|
||||||
$debugMode = Registry::get(ConfigFile::class)->getVar('iDebug');
|
|
||||||
$defaultExceptionHandler = new ExceptionHandler($debugMode);
|
|
||||||
$defaultExceptionHandler->writeExceptionToLog($exception);
|
|
||||||
} catch (Throwable $loggerException) {
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
try {
|
|
||||||
$loggerServiceFactory = new LoggerServiceFactory(new Context());
|
|
||||||
$logger = $loggerServiceFactory->getLogger();
|
|
||||||
$logger->error($exception->getTraceAsString());
|
|
||||||
} catch (Throwable $throwableWithoutPossibilityToWriteToLogFile) {
|
|
||||||
// It's not possible to log because e.g. the log file is not writable.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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->addTimelineMessures();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,11 +16,6 @@ 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
|
||||||
{
|
{
|
||||||
|
@ -1,35 +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\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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -16,82 +16,49 @@ 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 D3\DebugBar\Application\Models\AvailabilityCheck;
|
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||||
use D3\DebugBar\Application\Models\DebugBarHandler;
|
|
||||||
use D3\DebugBar\Core\DebugBarExceptionHandler;
|
|
||||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class ShopControl_DebugBar extends ShopControl_DebugBar_parent
|
class ShopControl_DebugBar extends ShopControl_DebugBar_parent
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$handler = oxNew(DebugBarHandler::class);
|
$this->_d3AddDebugBarComponent();
|
||||||
|
|
||||||
$handler->setErrorHandler();
|
|
||||||
$handler->setExceptionHandler();
|
|
||||||
$handler->addDebugBarComponent();
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $controllerKey
|
* @return void
|
||||||
* @param string|null $function
|
|
||||||
* @param array $parameters
|
|
||||||
* @param array $viewsChain
|
|
||||||
*/
|
*/
|
||||||
public function start($controllerKey = null, $function = null, $parameters = null, $viewsChain = null)
|
protected function _d3AddDebugBarComponent(): void
|
||||||
{
|
{
|
||||||
parent::start();
|
$userComponentNames = Registry::getConfig()->getConfigParam('aUserComponentNames');
|
||||||
|
$d3CmpName = DebugBarComponent::class;
|
||||||
|
$blDontUseCache = 1;
|
||||||
|
|
||||||
if (AvailabilityCheck::isAvailable() && AvailabilityCheck::ifDebugBarNotSet() && AvailabilityCheck::ifNoErrorOccured()) {
|
if (!is_array($userComponentNames)) {
|
||||||
|
$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 = method_exists($activeView, 'getComponent')
|
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class);
|
||||||
? $activeView->getComponent(DebugBarComponent::class)
|
|
||||||
: null;
|
|
||||||
if ($debugBarComponent) {
|
if ($debugBarComponent) {
|
||||||
AvailabilityCheck::markDebugBarAsSet();
|
|
||||||
echo $debugBarComponent->getRenderer()->renderHead();
|
echo $debugBarComponent->getRenderer()->renderHead();
|
||||||
$debugBarComponent->addTimelineMessures();
|
$debugBarComponent->addTimelineMessures();
|
||||||
echo $debugBarComponent->getRenderer()->render();
|
echo $debugBarComponent->getRenderer()->render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Throwable $exception
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
protected function debugBarHandleException(Throwable $exception): void
|
|
||||||
{
|
|
||||||
$exceptionHandler = new DebugBarExceptionHandler();
|
|
||||||
$exceptionHandler->handleUncaughtException($exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param StandardException $exception
|
|
||||||
*/
|
|
||||||
protected function _handleSystemException($exception)
|
|
||||||
{
|
|
||||||
$this->debugBarHandleException($exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param StandardException $exception
|
|
||||||
*/
|
|
||||||
protected function _handleCookieException($exception)
|
|
||||||
{
|
|
||||||
$this->debugBarHandleException($exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param StandardException $exception
|
|
||||||
*/
|
|
||||||
protected function _handleBaseException($exception)
|
|
||||||
{
|
|
||||||
$this->debugBarHandleException($exception);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -14,16 +14,13 @@
|
|||||||
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 string $sProfileName
|
* @param $sProfileName
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function startProfile(string $sProfileName): void
|
function startProfile(string $sProfileName): void
|
||||||
@ -62,6 +59,7 @@ 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])) {
|
||||||
@ -91,25 +89,17 @@ function debugVar($mVar, bool $blToFile = false): void
|
|||||||
fclose($f);
|
fclose($f);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
if (!isAdmin()) {
|
||||||
if (! AvailabilityCheck::isAvailable()) {
|
|
||||||
throw new UnavailableException();
|
|
||||||
}
|
|
||||||
$activeView = Registry::getConfig()->getTopActiveView();
|
$activeView = Registry::getConfig()->getTopActiveView();
|
||||||
/** @var DebugBarComponent|null $debugBarComponent */
|
/** @var DebugBarComponent $debugBarComponent */
|
||||||
$debugBarComponent = method_exists($activeView, 'getComponent')
|
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class);
|
||||||
? $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']. '(' . $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);
|
||||||
} catch (UnavailableException $e) {
|
} else {
|
||||||
dumpVar($mVar, $blToFile);
|
dumpVar($mVar, $blToFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,6 @@ php composer require d3/oxid-debugbar:^1.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.
|
||||||
|
|
||||||
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
|
||||||
|
@ -46,8 +46,6 @@ php composer require d3/oxid-debugbar:^1.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.
|
||||||
|
|
||||||
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
|
||||||
|
@ -1,46 +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\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
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
4
ToDo.md
4
ToDo.md
@ -1,5 +1,5 @@
|
|||||||
# ToDo
|
# ToDo
|
||||||
|
|
||||||
- clear tpl cache button
|
- clear tmp button
|
||||||
- phpinfo() overview
|
- phpinfo() overview
|
||||||
- automatic switch between Smarty and Twig
|
- automatic switch between Smarty and Twig
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "d3/oxid-debugbar",
|
"name": "d3/oxid-debugbar",
|
||||||
"description": "add the DebugBar to OXID eShop",
|
"description": "add the DegugBar to OXID eShop",
|
||||||
"type": "oxideshop-module",
|
"type": "oxideshop-module",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"oxid",
|
"oxid",
|
||||||
@ -26,7 +26,7 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.3",
|
"php": ">=7.3",
|
||||||
"oxid-esales/oxideshop-ce": "6.8 - 6.13",
|
"oxid-esales/oxideshop-ce": "6.8 - 6.10",
|
||||||
"maximebf/debugbar": "^1.18",
|
"maximebf/debugbar": "^1.18",
|
||||||
"ajgl/composer-symlinker": "^0.3.1",
|
"ajgl/composer-symlinker": "^0.3.1",
|
||||||
"cweagans/composer-patches": "^1.7.2"
|
"cweagans/composer-patches": "^1.7.2"
|
||||||
|
18
metadata.php
18
metadata.php
@ -13,9 +13,7 @@
|
|||||||
|
|
||||||
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';
|
||||||
@ -33,26 +31,16 @@ $aModule = [
|
|||||||
'de' => '',
|
'de' => '',
|
||||||
'en' => '',
|
'en' => '',
|
||||||
],
|
],
|
||||||
'version' => '1.2.0.0',
|
'version' => '1.0.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,7 +10,3 @@ 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#'
|
|
||||||
|
@ -5,5 +5,5 @@ 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
|
Loading…
Reference in New Issue
Block a user