From 4b47e5ddb63dcdc78f59ed721f27b00bb1b3bb1d Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Sun, 14 Aug 2022 23:13:06 +0200 Subject: [PATCH] show warning on activation if asset files doesn't exist --- README.en.md | 2 ++ README.md | 2 ++ Setup/Events.php | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ ToDo.md | 2 +- metadata.php | 4 +++- 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 Setup/Events.php diff --git a/README.en.md b/README.en.md index a08dd5d..eb70cff 100644 --- a/README.en.md +++ b/README.en.md @@ -46,6 +46,8 @@ php composer require d3/oxid-debugbar:^1.0 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". ## How to use diff --git a/README.md b/README.md index 9d691a4..2b0d25b 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ 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. +Lassen Sie die Dateien des Paketes `oxid-esales/oxideshop-ce` überschreiben. + Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module". ## Verwendung diff --git a/Setup/Events.php b/Setup/Events.php new file mode 100644 index 0000000..3494176 --- /dev/null +++ b/Setup/Events.php @@ -0,0 +1,53 @@ + + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + +namespace D3\DebugBar\Setup; + +use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException; +use D3\ModCfg\Application\Model\Install\d3install; +use Doctrine\DBAL\DBALException; +use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; +use OxidEsales\Eshop\Core\Exception\DatabaseErrorException; +use OxidEsales\Eshop\Core\Exception\StandardException; +use OxidEsales\Eshop\Core\Exception\SystemComponentException; +use OxidEsales\Eshop\Core\Registry; + +class Events +{ + /** + * @throws d3ShopCompatibilityAdapterException + * @throws DBALException + * @throws DatabaseConnectionException + * @throws DatabaseErrorException + * @throws StandardException + * @throws SystemComponentException + */ + public static function onActivate() + { + if (false === file_exists( + rtrim(Registry::getConfig()->getConfigParam('sShopDir'), '/').'/out/debugbar/debugbar.jas' + )) { + Registry::getUtilsView()->addErrorToDisplay( + 'The asset files cannot be found. Have you forgotten an installation step described in README? 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 README beschrieben ist? Dann führe die Installation bitte noch einmal aus.' + ); + } + } + + public static function onDeactivate() + { + } +} \ No newline at end of file diff --git a/ToDo.md b/ToDo.md index f559cd4..c5291ef 100644 --- a/ToDo.md +++ b/ToDo.md @@ -3,4 +3,4 @@ - clear tpl cache button - phpinfo() overview - automatic switch between Smarty and Twig -- displayed in live shop when logged in as admin \ No newline at end of file +- displayed in live shop when logged in as admin diff --git a/metadata.php b/metadata.php index f6b7d8a..059b365 100644 --- a/metadata.php +++ b/metadata.php @@ -42,7 +42,9 @@ $aModule = [ Config::class => Config_DebugBar::class, ShopControl::class => ShopControl_DebugBar::class, ], - 'events' => [], + 'events' => [ + 'onActivate' => '\D3\DebugBar\Setup\Events::onActivate', + ], 'templates' => [], 'settings' => [], 'blocks' => [],