protected function execute(InputInterface $input, OutputInterface $output) { $packages = $input->getArgument('package'); $packages = $this->getApplication()->getExtensionPackages()->findPackages($packages); if (!count($packages)) { throw new \RuntimeException('Invalid Packages'); } $this->getApplication()->loadFramework(); \KService::get('koowa:loader')->loadIdentifier('com://admin/migrator.helper'); /* $helper = $this->getHelperSet(); $io = new \Composer\IO\ConsoleIO($input, $output, $helper); $get_composer = function($root) use($input, $output, $helper,$io) { global $composerLoader; $embeddedComposerBuilder = new \Dflydev\EmbeddedComposer\Core\EmbeddedComposerBuilder($composerLoader, $root); return $embeddedComposerBuilder->build(); }; */ foreach ($packages as $package) { $mapper = new \Installer\Mapper($package->getSourcePath(), WWW_ROOT); $mapper->addCrawlMap('', array('#^(site|administrator)/(components|templates|media)/([^/]+)/.+#' => '\\1/\\2/\\3', '#^(media)/([^/]+)/.+#' => '\\1/\\2', '#CHANGELOG.php#' => '', '#^migration.*#' => '', '#manifest.xml#' => '')); $output->writeLn("<info>Linking {$package->getFullName()} Package</info>"); $mapper->symlink(); // $root = $get_composer(COMPOSER_ROOT)->createComposer($io); // $app = $get_composer($package->getRoot())->createComposer($io); // $requires = $root->getPackage()->getRequires(); // foreach($app->getPackage()->getRequires() as $require) // { // $output->writeLn((string)$require); // //$require = new \Composer\Package\Link('__root__',$require->getTarget(), $require->getConstraint(), null, $require->getPrettyConstraint()); // $requires[] = $require; // } // $root->getPackage()->setRequires($requires); // $installer = \Composer\Installer::create($io, $root); // $installer->setDryRun(true); // $installer->setUpdate(true); // $installer->run(); $this->_installExtensions($package->getSourcePath(), $output, $input->getOption('create-schema')); } }
public function symlink() { $target = WWW_ROOT; $mapper = new \Installer\Mapper(ANAHITA_ROOT, $target); $patterns = array('#^(site|administrator)/(components|templates|media)/([^/]+)/.+#' => '\\1/\\2/\\3', '#^(components|templates|libraries|media)/([^/]+)/.+#' => '\\1/\\2', '#^(cli)/.+#' => 'cli', '#^plugins/([^/]+)/([^/]+)/.+#' => 'plugins/\\1/\\2', '#^(administrator/)?(images)/.+#' => '\\1\\2', '#^(site|administrator)/includes/.+#' => '\\1/includes', '#^(vendors|migration)/.+#' => '', '#^configuration\\.php-dist#' => '', '#^htaccess.txt#' => ''); $patterns['#^installation/.+#'] = ''; $mapper->addMap('vendor/mc/rt_missioncontrol_j15', 'administrator/templates/rt_missioncontrol_j15'); $mapper->addCrawlMap('vendor/joomla', $patterns); $mapper->addCrawlMap('vendor/nooku', $patterns); $mapper->addCrawlMap('src', $patterns); $mapper->symlink(); $mapper->getMap('vendor/joomla/index.php', 'index.php')->copy(); $mapper->getMap('vendor/joomla/htaccess.txt', '.htaccess')->copy(); $mapper->getMap('vendor/joomla/administrator/index.php', 'administrator/index.php')->copy(); @mkdir($target . '/tmp', 0755); @mkdir($target . '/cache', 0755); @mkdir($target . '/log', 0755); @mkdir($target . '/administrator/cache', 0755); $vendorLink = new \Installer\Map(COMPOSER_VENDOR_DIR, WWW_ROOT . '/vendor'); $vendorLink->symlink(); }