Executes the script.

@param \Composer\Script\Event $event
The script event.
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.');
  }
375875
public function handle(EventInterface $event)
    {

        try {
            // load the application server instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();

            // write a log message that the event has been invoked
            $applicationServer->getSystemLogger()->info($event->getName());

            // and initialize a console for each node found in the configuration
            /** @var \AppserverIo\Psr\Cli\Configuration\ConsoleConfigurationInterface $consoleNode */
            foreach ($applicationServer->getSystemConfiguration()->getConsoles() as $consoleNode) {
                /** @var \AppserverIo\Appserver\Core\Interfaces\ConsoleFactoryInterface $consoleFactory */
                $consoleFactory = $consoleNode->getFactory();

                // use the factory if available
                /** @var \AppserverIo\Appserver\Core\Interfaces\ConsoleInterface $console */
                $console = $consoleFactory::factory($applicationServer, $consoleNode);

                // register the console as service
                $applicationServer->bindService(ApplicationServerInterface::ADMINISTRATION, $console);
            }

        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }
564525
protected function handle(Event $event): void
    {
        $method = 'apply'.ClassName::short($event);

        if (!method_exists($this, $method)) {
            return;
        }

        $this->$method($event);
    }
139024
public function execute(Event $event = null)
    {
        $event = $event ? $event : $this->createEvent();
        $this->logger->info('Starting web hook handle');

        if (!$event->isValid()) {
            $this->logger->error('Found not valid event from '.$event->getHost());
            $this->return404();

            return;
        }

        if (!$this->checkPermissions($event, $this->options)) {
            return;
        }

        $repoName = $event->getRepositoryName();
        $branchName = $event->getBranchName();
        $repository = $this->getRepository($repoName);
        if (!$repository || !($branch = $repository->getBranch($branchName))) {
            $this->logger->warning('Repository: '.$repoName.' and branch: '.$branchName.' not found in the settings');
            $this->return404();

            return;
        }

        $commandResults = $this->commandExecutor->execute(array($this, $repository, $branch));
        $this->sendEmails($event, $commandResults);

        $this->logger->info('End of web hook handle');
    }
930675
public function handle(EventMessage $event)
    {
        if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {
            if ($event->getCommandId() == $this->lastCommandId) {
                $this->lastAgiResult = trim($event->getResult());
            }
        }
    }
325619
public static function execute(Event $event) {
    $composer = $event->getComposer();
    $handler = new static(
      $composer->getPackage(),
      $composer->getLocker()
    );
    $encoder = new IniEncoder();
    $make = $handler->make();
    $core = $handler->makeCore($make);
    file_put_contents('drupal-org-core.make', $encoder->encode($core));
    file_put_contents('drupal-org.make', $encoder->encode($make));
  }
31907
public function handle($event)
    {
        if ($event instanceof RouteMatched) {
            $this->handleLaravelRoute($event);
        }

        if ($event instanceof GzeroRouteMatched) {
            $this->handleRoute($event);
        }
    }
223689
public function fire($event, $args)
    {
        $onEvent = $this->getConfig('events.'.$event);

        if ($onEvent instanceof Closure) {
            $onEvent($args);
        }
    }
544215
public function handle($event): void
    {
        $commentsService = app()->make('InetStudio\Comments\Contracts\Services\Back\CommentsServiceContract');

        $user = $event->user;

        $commentsService->getModel()::where([
            ['user_id', '=', 0],
            ['email', '=', $user->email],
        ])->update([
            'user_id' => $user->id,
            'name' => $user->name,
        ]);
    }
165863
public function execute($eventName, $object)
    {
        if (isset($this->events[$eventName]) && is_array(($this->events[$eventName]))) {
            foreach ($this->events[$eventName] as $method) {
                call_user_func([$object, $method]);
            }
        }
    }
284078
public function handle(EventInterface $event)
    {

        try {
            // load the application server and the naming directory instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();
            /** @var \AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory */
            $namingDirectory = $applicationServer->getNamingDirectory();

            // write a log message that the event has been invoked
            $applicationServer->getSystemLogger()->info($event->getName());

            // deploy the applications for all containers
            /** @var \AppserverIo\Psr\ApplicationServer\Configuration\ContainerConfigurationInterface $containerNode */
            foreach ($applicationServer->getSystemConfiguration()->getContainers() as $containerNode) {
                // load the container instance to deploy the applications for
                /** @var \AppserverIo\Psr\ApplicationServer\ContainerInterface $container */
                $container = $namingDirectory->search(
                    sprintf(
                        'php:services/%s/%s',
                        $applicationServer->runlevelToString(ApplicationServerInterface::NETWORK),
                        $containerNode->getName()
                    )
                );

                // load the containers deployment
                /** @var \AppserverIo\Psr\Deployment\DeploymentInterface $deployment */
                $deployment = $container->getDeployment();
                $deployment->injectContainer($container);

                // deploy and initialize the container's applications
                $deployment->deploy();
            }

        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }
830481
protected function fireEvent($event)
    {
        $this->app['events']->fire(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]);
    }
1143705
public function fire(string $event, array $arguments = null) {
        $arguments = (array)$arguments;
        foreach ($this->getBindings($event) as $callback) {
            if (is_callable($callback)) {
                call_user_func_array($callback, $arguments);
            }
        }
    }
249959
public function handle(EventInterface $event)
    {

        try {
            // load the application server instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();

            // write a log message that the event has been invoked
            $applicationServer->getSystemLogger()->info($event->getName());

            // load the service instance and switch the umask
            /** @var \AppserverIo\Appserver\Core\Api\DeploymentService $service */
            $service = $applicationServer->newService('AppserverIo\Appserver\Core\Api\DeploymentService');
            $service->initUmask($applicationServer->getSystemConfiguration()->getUmask());

        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }
532339
public function onPostUpdateCmd(Event $event)
    {
        $this->bridgeFactory->createBridge($event->getIO())
            ->update($event->getComposer());
    }
304944
public function run()
    {
        $events = $this->dueEvents(EventReposity::getEvents());

        foreach ($events as $event) {
            $event->execute();
        }
    }
249656
public function handle(EventInterface $event)
    {

        try {
            // load the application server, naming directory and system configuration instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();
            /** @var \AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory */
            $namingDirectory = $applicationServer->getNamingDirectory();
            /** @var \AppserverIo\Psr\ApplicationServer\Configuration\SystemConfigurationInterface $systemConfiguration */
            $systemConfiguration = $applicationServer->getSystemConfiguration();

            // initialize the loggers
            $loggers = array();
            foreach ($systemConfiguration->getLoggers() as $loggerNode) {
                $loggers[$loggerNode->getName()] = LoggerFactory::factory($loggerNode);
            }

            // register the logger callbacks in the naming directory
            foreach ($loggers as $name => $logger) {
                $namingDirectory->bind(sprintf('php:global/log/%s', $name), $logger);
            }

            // set the initialized loggers finally
            $applicationServer->setLoggers($loggers);

        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }