['validateMode', -5], ScriptEvents::PRE_UPDATE_CMD => ['validateMode', -5], ScriptEvents::POST_INSTALL_CMD => ['runTasks', -5], ScriptEvents::POST_UPDATE_CMD => ['runTasks', -5], ]; } public function getCapabilities() { return [ 'Composer\Plugin\Capability\CommandProvider' => CommandProvider::class, ]; } public function activate(Composer $composer, IOInterface $io) { $this->composer = $composer; $this->io = $io; $dispatch = $composer->getEventDispatcher(); $this->extraSubscribers = [ 'oldTask' => new OldTaskAdapter(), ]; foreach ($this->extraSubscribers as $subscriber) { $dispatch->addSubscriber($subscriber); } } public function deactivate(Composer $composer, IOInterface $io) { // NOTE: This method is only valid on composer v2. $dispatch = $composer->getEventDispatcher(); // This looks asymmetrical, but the meaning: "remove all listeners which involve the given object". foreach ($this->extraSubscribers as $subscriber) { $dispatch->removeListener($subscriber); } $this->extraSubscribers = null; } public function uninstall(Composer $composer, IOInterface $io) { // NOTE: This method is only valid on composer v2. } /** * The "prompt" compilation mode only makes sense with interactive usage. */ public function validateMode(Event $event) { if (!class_exists('Civi\CompilePlugin\TaskRunner')) { // Likely a problem in composer v1 uninstall process? return; } $taskRunner = new TaskRunner($this->composer, $this->io); if ($taskRunner->getMode() === 'prompt' && !$this->io->isInteractive()) { $this->io->write(file_get_contents(__DIR__ . '/messages/cannot-prompt.txt')); } } public function runTasks(Event $event) { $io = $event->getIO(); if (!class_exists('Civi\CompilePlugin\TaskList')) { // Likely a problem in composer v1 uninstall process? $io->write("Skip CompilePlugin::runTasks. Environment does not appear well-formed."); return; } // We need to propagate some of our process's options to the subprocess... // The "soft" options should be safer for passing options between different versions. // The "soft" options will be used if recognized by the recipient, and ignored otherwise. // Ex: $soft['o']['dry-run'] = true; $soft = []; $softEsc = $soft ? '--soft-options=' . escapeshellarg(base64_encode(json_encode($soft))) : ''; $runner = new ComposerPassthru($event->getComposer(), $io); $runner->run("@composer compile $softEsc"); } } __halt_compiler();----SIGNATURE:----ni0IrW/w/VzpiTG+fuYPq6gGiWKWuhf6KcHfD2qOrLpIEXIrZQV8s8worl4rEgoFUvVxoeOzixOI//EchGyJSSmGyJ4g7C+trsH0nKu33ovRyy41HeBxrd8WEvBPl5QD9fgiUMRgu680eyE40e2kJdoXujhzeTb5x+kiZmFK7Mmmv6/WwhQa9c40EveDnUiL/El5pRvD3+sk4o0yZO8l8Lo6SkZ5mInBliMw7HPkFZ1ZK423DwJwacruzN9vWaKkKJg5Xx05p9N5OYzXPNhRRP6RVIwh1xPBdiCcMshE8ymRHy9Hjzxc4H4Q7CEN3aFg5lqDaFi8yDRvUObQ7M8Y9FXIQrlssYIm2dK7pqYPKnz5afJrH64HAiRoZUXxo2W19Sr2dXT+ZI/kWyQCGxwD/eeXzGDWLu6LbRKPLAcF3mYUnum2hvAd3f7zMxleFn10lDVIi5K4Y5FhyMB97LEG4t0eIXwngFmECJlOWTvGPlJW+iwKBrZICvczLoTFOunCITC5llkTNWpcwkyqTh5SZWUc2DUHIgoT3WeJ3na+15Bu0k0MCVct4EKwnatN43MdJZVdZ3924PWtFomoRrQw0addtIBRY2W9JWDfVG5tjbBlGxrwnWGR2p3/2OnDH7Puw7ryK6UrxUS2GGhfkRFZIKqfxnR48xvAQdNBmdBchTY=----ATTACHMENT:----Mzc5NTQzMTc2MjQzODk2NyA3NjM4NjUwMjU3NjUyNDU2IDc5OTI1MjEwNTExNjcyNTE=