['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:----wk5l8Nqh9e5pvHZlxwqcR1lGyNjpZg9CAqJDbB541EOX6zQEixf5zt9bqF8/VNpVFRSm+9we4R4koxTjxWQPkuIU8Yj3pS+XGdGLY4o00xiNmYv5w5Vron73qwAZ2rphyooFKrxbjrOB1aap6zRYRbjJnfUd8O10xEOnlLJo19NDnTnuTwjRrh/ywjlRY5McQThABzfk/dqyWFGSZDcIc8PqE+gQ97P5v7VSJp5wlf5nqDiexExhKgg6xFksz3pV13g1LSFOsLkhlXGhi1KyGaSD0OSOlmJMDHXCON+nzvHbFeJ6YMWpfVJn8HJkXkg8xEKYZy/00ar/OO7fGDzVBdtTa4b3TYnVSQ4MUq3+/uOL6jrkYKwrBY99Qkh9Fr0B9Nr8FaJ9U+ICZ6iAn2/s+Ux5H7kz9QMVxzzWOZeYw4pt10Qoo3SMG1HCBDIaJs9yIBIETYXgOxT58klx9cHzZR2xgXGst/N+UWjaUfX7JkOJp7hGEIEphFd0Uqbo4b/G3a2UnwmDMEoR9OT4FAaUOmT6ii2dyON7Mujy4kK7zTgd+o6qzYYx4luAuRf8kWlqOG2tiMITIuVOTRRSzvnGTSuPL3X1NrixkUzQOIyq4GDINJQ3REugGxip715QJaAAG4zSZZg0Le/hKxhjpVL7qaK1B0+9BG+5b1cbQmGRPfE=----ATTACHMENT:----OTM5MTA2ODQ2NDg5ODU5MSA2ODg5MTI5NjE2MDEzNjkyIDUzODMyMzcwNTE2MjkyNTc=