Joomlatools\Console\Command\Plugin\Install::execute PHP 메소드

execute() 보호된 메소드

protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $result = shell_exec('command -v composer >/dev/null 2>&1 || { echo "false"; }');
        if (trim($result) == 'false') {
            $output->writeln('<error>Composer was not found. It is either not installed or globally available</error>');
            return;
        }
        $plugin_path = $this->getApplication()->getPluginPath();
        if (!file_exists($plugin_path)) {
            `mkdir {$plugin_path}`;
        }
        $package = $input->getArgument('package');
        if (strpos($package, ':') === false) {
            $name = $package;
            $version = '';
        } else {
            list($name, $version) = explode(':', $package);
        }
        exec("composer show --all {$name} {$version} 2>&1", $result, $code);
        if ($code === 1) {
            $output->writeln("<error>The {$package} plugin you are attempting to install cannot be found</error>");
            return;
        }
        $type = '';
        foreach ($result as $line => $content) {
            $content = trim($content);
            if (strpos($content, 'type') === 0) {
                $parts = explode(':', $content);
                if (count($parts) > 1) {
                    $type = trim($parts[1]);
                    break;
                }
            }
        }
        if ($type != 'joomlatools-console-plugin') {
            $output->writeln("<comment>{$package} is not a Joomla console plugin</comment>");
            $output->writeln('<error>Plugin not installed</error>');
            return;
        }
        passthru("composer --no-progress --working-dir={$plugin_path} require {$package}");
    }