/**
* Handle an event callback following an install or update command. If our
* plugin was installed during the run then trigger an update command to
* process any merge-patterns in the current config.
*
* @param Event $event
*/
public function onPostInstallOrUpdate(Event $event)
{
// @codeCoverageIgnoreStart
if ($this->state->isFirstInstall()) {
$this->state->setFirstInstall(false);
$this->logger->info('<comment>' . 'Running additional update to apply merge settings' . '</comment>');
$config = $this->composer->getConfig();
$preferSource = $config->get('preferred-install') == 'source';
$preferDist = $config->get('preferred-install') == 'dist';
$installer = Installer::create($event->getIO(), Factory::create($event->getIO(), null, false));
$installer->setPreferSource($preferSource);
$installer->setPreferDist($preferDist);
$installer->setDevMode($event->isDevMode());
$installer->setDumpAutoloader($this->state->shouldDumpAutoloader());
$installer->setOptimizeAutoloader($this->state->shouldOptimizeAutoloader());
if ($this->state->forceUpdate()) {
// Force update mode so that new packages are processed rather
// than just telling the user that composer.json and
// composer.lock don't match.
$installer->setUpdate(true);
}
$installer->run();
}
// @codeCoverageIgnoreEnd
}