Adds package to $this->unsupportedPackages if applicable.

@param \Composer\Installer\PackageEvent $event
482864
public function onPostPackageEvent(\Composer\Installer\PackageEvent $event)
    {
        $package = $this->getDrupalPackage($event->getOperation());
        if ($package) {
            if (!$this->isPackageSupported($package)) {
                $this->unsupportedPackages[$package->getName()] = $package;
            }
        }
    }
378977
public static function postPackageInstall(PackageEvent $pEvent)
    {
        if ($pEvent->getOperation() instanceof \Composer\DependencyResolver\Operation\InstallOperation) {
            $packageName = $pEvent->getOperation()->getPackage()->getName();
        } else if ($pEvent->getOperation() instanceof \Composer\DependencyResolver\Operation\UpdateOperation) {
            $packageName = $pEvent->getOperation()->getInitialPackage()->getName();
        } else {
            throw new Exception("Event is not supported.");
        }

        $appPath = realpath('.') . DIRECTORY_SEPARATOR;

        $path = realpath('.'
              . DIRECTORY_SEPARATOR
              . $pEvent->getComposer()->getConfig()->get('vendor-dir')
              . DIRECTORY_SEPARATOR
              . $packageName
              . DIRECTORY_SEPARATOR
              . self::SETUP_DIR
              . DIRECTORY_SEPARATOR
              . self::CLI_FILE
        );

        if ($path and is_readable($path)) {
            $config = require($path);

            if (is_array($config)) {
                foreach ($config as $cmd => $args) {
                    if (! is_array($args)) {
                        continue;
                    } else if (count($args) == count($args, COUNT_RECURSIVE)) {
                        self::_execute($cmd, $args);
                    } else {
                        foreach ($args as $cmdArgs) {
                            self::_execute($cmd, $cmdArgs);
                        }
                    }
                }
            }
        }

        return true;
    }
995094
public static function writePbjSchemaStoresFile(PackageEvent $event)
    {
        if (!$event->isDevMode()) {
            return;
        }

        $dirs = [];
        /** @var PackageInterface $package */
        foreach ($event->getInstalledRepo()->getPackages() as $package) {
            if (!$package instanceof PackageInterface) {
                continue;
            }

            if ('pbj-schema-store' !== $package->getType()) {
                continue;
            }

            $dir = sprintf('$vendorDir.\'/%s/schemas/\'', $package->getName());

            // override for current package
            if ($event->getComposer()->getPackage()->getName() == $package->getName()) {
                $dir = '__DIR__.\'/schemas/\'';
            }

            $dirs[] = sprintf('%s    %s', PHP_EOL, $dir);
        }

        if (empty($dirs)) {
            return;
        }

        $dirs = array_unique($dirs);
        $dirs = implode(',', $dirs);

        $event->getIO()->write('<info>Writing "pbj-schema-store" locations to "pbj-schema-stores.php"</info>');

        $text = <<<TEXT
<?php

/**
 * DO NOT EDIT THIS FILE as it will be overwritten by Composer as part of
 * the installation/update process.
 *
 * Registers all directories from all required packages which are of
 * of the type "pbj-schema-store".
 *
 * This file has been auto-generated by the Pbj Compiler.
 */

\$vendorDir = realpath(__DIR__.'/vendor');

\\Gdbots\\Pbjc\\SchemaStore::addDirs([{$dirs}
]);

TEXT;

        $fs = new Filesystem();
        $fs->dumpFile('pbj-schema-stores.php', $text);
    }
709372
public static function deleteIgnoredFiles(PackageEvent $event)
    {
        if (null === $package = static::getLibraryPackage($event->getOperation())) {
            return;
        }

        $section = static::getIgnoreConfigSection();
        $manager = IgnoreFactory::create(static::getConfig($event), $event->getComposer(), $package, null, $section);
        $manager->cleanup();
    }
1227246
public function publishFiles(Event $event)
    {
        $cmd = $this->composer->getPackage()->getExtra()[self::PUBLISH_CMD] ?? null;

        if ($cmd === null) {
            return;
        }

        $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();

        foreach ($packages as $package) {
            $publish = $package->getExtra()[self::PUBLISH_KEY] ?? null;

            if (empty($publish)) {
                continue;
            }

            foreach ($publish as $data => $options) {
                $this->publish(
                    $cmd,
                    $this->composer->getInstallationManager()->getInstallPath($package),
                    $data,
                    $options
                );
            }
        }
    }
280915
public static function cleanUpOldModules(Event $event)
    {
        $composer = $event->getComposer();
        $requires = $composer->getPackage()->getRequires();

        $projectPath = str_replace('vendor/vkf/shop', '', $composer->getInstallationManager()->getInstallpath($composer->getPackage()));
        $modulePath = $projectPath . 'htdocs/modules';
        foreach (array('ra', 'vkf') as $renzelVendorDir) {
            foreach (glob($modulePath . '/' . $renzelVendorDir . '/*') as $file) {
                if (is_dir($file)) {
                    $packageId = str_replace($modulePath . '/', '', $file);
                    if (!isset($requires[$packageId])) {
                        self::rmdir($file);
                        $event->getIO()->write('Deleted old package ' . $packageId);
                    }
                }
            }
        }
    }
192185
public static function Go(Event $event)
    {
        $event->getIO()->writeError('<info>Updating .gitignore: </info>', false);

        $composer = $event->getComposer();
        $repositoryManager = $composer->getRepositoryManager();
        $installManager = $composer->getInstallationManager();
        $extraConfiguration = $composer->getPackage()->getExtra();

        // Check in composer extra configuration if devOnly option is set
        $devRequires = (array_key_exists('autogitignore', $extraConfiguration)
            && $extraConfiguration['autogitignore'] == 'devOnly');

        // If devOnly option is set
        if ($devRequires) {
            // Grab original list of all require-dev packages
            $devRequires = array_keys($composer->getPackage()->getDevRequires());
            // Grab original list of all require packages
            $requires = array_keys($composer->getPackage()->getRequires());

            // Grab recursively require and require-dev packages
            foreach ($repositoryManager->getLocalRepository()->getPackages() as $package) {
                $devRequires = array_merge($devRequires, array_keys($package->getDevRequires()));
                $requires = array_merge($requires, array_keys($package->getRequires()));
            }

            // Remove duplicates
            $devRequires = array_unique($devRequires);
            $requires = array_unique($requires);

            // Sort packages
            sort($devRequires);
            sort($requires);
        }

        $packages = array();
        foreach ($repositoryManager->getLocalRepository()->getPackages() as $package) {
            // Test if we need to ignore the package
            // If the option devOnly is set, we check that
            // the package is not in the list of require-dev
            // OR is set in the list of require packages
            // before skipping.
            if ($devRequires && (!in_array($package->getName(), $devRequires) || in_array($package->getName(), $requires))) {
                continue;
            }
            $path = $installManager->getInstallPath($package);
            $packages[] = '/' . preg_replace('~^' . preg_quote(str_replace('\\', '/', getcwd()) . '/') . '~', '', str_replace('\\', '/', realpath($path))) . '/';
        }

        $packages = array_unique($packages);
        sort($packages);

        try {
            $gitIgnoreFile = GitIgnoreFile::create(getcwd() . DIRECTORY_SEPARATOR . '.gitignore');
            $gitIgnoreFile->setLines($packages);
            $gitIgnoreFile->save();
        } catch (Exception $exception) {
            $event->getIO()->writeError('<info>Failed - ' . $exception->getMessage() . '</info>');

            return false;
        }

        $event->getIO()->writeError('<info>Done - ' . count($packages) . ' packages ignored.</info>');

        return true;
    }
68357
public static function prePackageUninstall(PackageEvent $event){
		$installedPackage = $event->getOperation()->getPackage()->getName();
		if (self::checkConfig($event, $installedPackage)) {
			self::phinxRollbackFromPackageName($event, $installedPackage);
		} else {
			die();
		}
	}
1256738
public static function postAutoloadDump(Event $event): void
    {
        $event->getIO()->write('<info>    Packages Auto-Discovery [Executed]</info>');
        $vendorPath = $event->getComposer()->getConfig()->get('vendor-dir');
        $manifestPath = $vendorPath . '/../bootstrap/cache/packages.php';

        self::discoverPackages($vendorPath, $manifestPath);
    }
930211
public static function getConfig(PackageEvent $event)
    {
        foreach ($event->getComposer()->getPluginManager()->getPlugins() as $plugin) {
            if ($plugin instanceof FxpAssetPlugin) {
                return $plugin->getConfig();
            }
        }

        throw new \RuntimeException('The fxp composer asset plugin is not found');
    }
22179
public function onPostPackageEvent(PackageEvent $event) {
    // Get the effected package from the Event.
    $installed_package = NULL;
    $operation = $event->getOperation();
    if ($operation instanceof UpdateOperation) {
      $installed_package = $operation->getTargetPackage();
    }
    else {
      $installed_package = $operation->getPackage();
    }
    $package_extra = $installed_package->getExtra();

    // If the effected package has installers, reset cached installers.
    if (isset($package_extra) && isset($package_extra['installer-paths'])) {
      $composer = $event->getComposer();
      $composer->getInstallationManager()->removeInstaller($this->installer);
      $composer->getInstallationManager()->addInstaller($this->installer);
      $this->installer->clearCache();
    }
  }
86415
public function onBadPacket(ErrorEvent $event) {
        $this->errorResponse($event->sender, $event->code, $event->errstr);   
    }
979788
public function onPostInstall(Event $event)
    {
        $lockFile = new JsonFile($this->lockFile);
        if ($lockFile->exists()) {
            $this->loadPackages($lockFile);
        } else {
            $this->scanPackages();
        }
        $this->runAction('install');
    }
162953
public static function execute(Event $event) {
    $io = $event->getIO();

    // Search upwards for a composer.json which depends on Open Social.
    $io->write('Searching for root package...');

    $file = static::getRootPackage();

    $package = $file->read();

    // Add the Asset Packagist repository if it does not already exist.
    if (isset($package['repositories'])) {
      $repository_key = NULL;

      foreach ($package['repositories'] as $key => $repository) {
        if ($repository['type'] == 'composer' && strpos($repository['url'], 'https://asset-packagist.org') === 0) {
          $repository_key = $key;
          break;
        }
      }

      if (is_null($repository_key)) {
        $package['repositories'][] = [
          'type' => 'composer',
          'url' => 'https://asset-packagist.org',
        ];
      }
    }

    // oomphinc/composer-installers-extender is required by Open Social and
    // depends on composer/installers, so it does not need to be specifically
    // included.
    unset(
      $package['require']['oomphinc/composer-installers-extender']
    );

    // Check if we need to add the bower and npm assets to the installer types.
    if (!isset($package['extra']['installer-types']) || !in_array('bower-asset', $package['extra']['installer-types'])) {
      $package['extra']['installer-types'][] = 'bower-asset';
    }
    if (!in_array('npm-asset', $package['extra']['installer-types'])) {
      $package['extra']['installer-types'][] = 'npm-asset';
    }

    // Get root folder based on the location of Drupal core. If we do it in this
    // way we can also support projects that have
    //    $package['extra']['installer-paths']['']
    $root_path = 'html/';
    foreach ($package['extra']['installer-paths'] as $path => $install_type) {
      if (in_array('drupal/core', $install_type, TRUE)) {
        // If Drupal core is installed in the root path we also want the
        // libraries there.
        if ($path == 'core') {
          $root_path = '';
        }
        else {
          $parts = explode('/core', $path);
          if (!empty($parts)) {
            $root_path = $parts[0] . '/';
          }
        }

        break;
      }
    }

    // Add the different library types to the installer paths.
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:drupal-library';
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:bower-asset';
    $package['extra']['installer-paths'][$root_path . 'libraries/{$name}'][] = 'type:npm-asset';

    $file->write($package);
    $io->write('Successfully updated your root composer.json file.');
  }
1225872
public function onInstallReleaseExecuteComposerInstall(InstallReleaseEvent $event, $eventName, EventDispatcherInterface $eventDispatcher)
    {
        $release = $event->getRelease();
        $host = $release->getWorkspace()->getHost();
        $connection = $this->ensureConnection($host);

        $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Installing Composer dependencies.', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_IN_PROGRESS)));

        $authenticationFile = $release->getPath().'/auth.json';
        if (empty($this->authentication) === false) {
            $connection->putContents($authenticationFile, json_encode($this->authentication));
        }

        $connection->changeWorkingDirectory($host->getPath());
        $result = $connection->executeCommand(sprintf('php composer.phar install --no-interaction --working-dir="%s" --no-dev --no-scripts --optimize-autoloader', $release->getPath()));

        if ($connection->isFile($authenticationFile)) {
            $connection->delete($authenticationFile);
        }

        if ($result->isSuccessful()) {
            $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::NOTICE, 'Installed Composer dependencies.', $eventName, $this, array('event.task.action' => TaskInterface::ACTION_COMPLETED, 'output.resetLine' => true)));
            $eventDispatcher->dispatch(AccompliEvents::LOG, new LogEvent(LogLevel::DEBUG, "{separator} Command output:{separator}\n{command.result}{separator}", $eventName, $this, array('command.result' => $result->getOutput(), 'separator' => "\n=================\n")));
        } else {
            throw new TaskCommandExecutionException('Failed installing Composer dependencies.', $result, $this);
        }
    }
1114730
public static function dump(Event $event)
    {
        $packages = array_keys($event->getComposer()->getPackage()->getRequires());
        if (!$packages) {
            return;
        }
    }
40381
public static function postUpdateAndInstall(Event $event)
    {
        if (!defined('FLOW_PATH_ROOT')) {
            define('FLOW_PATH_ROOT', Files::getUnixStylePath(getcwd()) . '/');
        }

        if (!defined('FLOW_PATH_PACKAGES')) {
            define('FLOW_PATH_PACKAGES', Files::getUnixStylePath(getcwd()) . '/Packages/');
        }

        if (!defined('FLOW_PATH_CONFIGURATION')) {
            define('FLOW_PATH_CONFIGURATION', Files::getUnixStylePath(getcwd()) . '/Configuration/');
        }
        if (!defined('FLOW_PATH_TEMPORARY_BASE')) {
            define('FLOW_PATH_TEMPORARY_BASE', Files::getUnixStylePath(getcwd()) . '/Data/Temporary');
        }

        Files::createDirectoryRecursively('Configuration');
        Files::createDirectoryRecursively('Data');

        Files::copyDirectoryRecursively('Packages/Framework/Neos.Flow/Resources/Private/Installer/Distribution/Essentials', './', false, true);
        Files::copyDirectoryRecursively('Packages/Framework/Neos.Flow/Resources/Private/Installer/Distribution/Defaults', './', true, true);
        $packageManager = new PackageManager(PackageManager::DEFAULT_PACKAGE_INFORMATION_CACHE_FILEPATH, FLOW_PATH_PACKAGES);
        $packageManager->rescanPackages();

        chmod('flow', 0755);
    }