['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) { $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) { } /** * 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:----wU7WwX8S0Nd3h1XodtQ+oh4ffAeDnERID5yqz7q69rWcr0WV5G6GMYO0GqyqLqyX0bMepCuRb118j9AOL6VAjdzaQ/b5jB9T/XG1Ys6uvAQQ9F76gnt0+AO412AnS+GcD8ZNibWZlum2WM5rf4HefZ04DhLONw/R6iMKphOxoozgaJ/aFPW5HB8FcbbW+/5m3dQCImO6bZIX1tc8uPXuWOTxCMEIGXSl3vkgryprVK/lKeETyaSC7y/21UujPeHeDGPOAaqMZpbtYiBXJPXjtkzjKKuEqQySp0rVEradBY2I3CAXtlbr7SO0mzs412HLXPDzzYxYITox03S4SrT/m7+3WbBpNsDhz/n5Jntig2Tntx07KMQa4A/ZPdwUaA2a3o1tDJ0Xnx95xMUWbaRRX4m675jOQvC4gjnAAbqk081fz7hVdKA8JR4u2OralwNNsbnx1ewdDUBGyd84Sv1wd5MuV8OcBaTV8/MHv3ev7EBZ8Y7aWDDtO6El7dhBPBx3KZWdOTDzuK1FrbLIco2+7GtDRcMkZV1DyHA0y61jcM8CHMVkNWt6NMRLlXWhLCPG54Q5jm1+rFl1H2iTVNFSj8qy1E6eukqpFNH7u7+99ic0PeAdMzMwda+I7bEBBiUGueWMdVrhJu2ZU6JncVclvGBn+JkrmCB5mhwARK+Yowo=----ATTACHMENT:----MzUwMDk3MjMzMDA4MDkzNCAyNjAwMDMzNzg4MDc5OTY4IDIwNTE0Mjg3NzM3MTI1MTc=