Commit 5a736e17 authored by Henning Leutz's avatar Henning Leutz 🥋

Merge branch '995-menu-entries-don-t-show-after-installing-a-package' into 'dev'

feat: adds warning to not user composer require or remove

See merge request !19
parents 06d63dd7 29d651c5
......@@ -6,8 +6,9 @@
namespace QUI\Package\Composer;
use QUI;
use Composer\Plugin\PreCommandRunEvent;
use Composer\Script\Event;
use QUI;
/**
* Class CommandEvents
......@@ -90,4 +91,28 @@ class CommandEvents
QUI::load();
}
/**
* Called before every composer command.
* Using the commands require or remove causes cache inconsistencies.
* Therefore we tell the user how to prevent this.
*
* @param PreCommandRunEvent $Event
*/
public static function preCommandRun(PreCommandRunEvent $Event)
{
$command = $Event->getCommand();
if ($command !== 'require' && $command !== "remove") {
return;
}
echo PHP_EOL;
echo 'WARNING:' . PHP_EOL;
echo "Using the '{$command}' command might cause cache inconsistencies." . PHP_EOL;
echo "If the QUIQQER menu bar disappears, clear the cache." . PHP_EOL;
echo 'You should edit the composer.json directly and then execute a composer update.' . PHP_EOL;
echo PHP_EOL;
}
}
......@@ -441,6 +441,9 @@ class Manager extends QUI\QDOM
'post-update-cmd' => [
'QUI\\Package\\Composer\\CommandEvents::postUpdate'
],
'pre-command-run' => [
'QUI\\Package\\Composer\\CommandEvents::preCommandRun'
],
// package events
'pre-package-install' => [
'QUI\\Package\\Composer\\PackageEvents::prePackageInstall'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment