public function MergePlugin::onPostInstallOrUpdate in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/wikimedia/composer-merge-plugin/src/MergePlugin.php \Wikimedia\Composer\MergePlugin::onPostInstallOrUpdate()
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.
Parameters
Event $event:
File
- vendor/
wikimedia/ composer-merge-plugin/ src/ MergePlugin.php, line 271
Class
- MergePlugin
- Composer plugin that allows merging multiple composer.json files.
Namespace
Wikimedia\ComposerCode
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
}