public function symlinkProjects(InputInterface $input, OutputInterface $output) { static $dependencies = array('extman' => array('koowa'), 'docman' => array('extman', 'koowa', 'com_files'), 'fileman' => array('extman', 'koowa', 'com_files'), 'logman' => array('extman', 'koowa', 'com_activities')); $project_folder = $input->getOption('projects-dir'); $destination = $this->target_dir; $projects = array(); foreach ($this->symlink as $symlink) { $projects[] = $symlink; if (array_key_exists($symlink, $dependencies)) { $projects = array_merge($projects, $dependencies[$symlink]); } } // If we are symlinking Koowa, we need to create this structure to allow multiple symlinks in them if (in_array('koowa', $projects)) { $dirs = array($this->target_dir . '/libraries/koowa/components', $this->target_dir . '/media/koowa'); foreach ($dirs as $dir) { if (!is_dir($dir)) { mkdir($dir, 0777, true); } } } foreach ($projects as $project) { $root = $project_folder . '/' . $project; if (!is_dir($root)) { continue; } if (is_dir($root . '/code')) { $root = $root . '/code'; } $iterator = new Symlink\Iterator($root, $destination); while ($iterator->valid()) { $iterator->next(); } } }
protected function execute(InputInterface $input, OutputInterface $output) { $source = realpath($input->getArgument('source')); $target = realpath($input->getArgument('target')); if ($source === false || $target === false) { throw new \InvalidArgumentException('Invalid folders passed'); } $iterator = new Iterator($source, $target); while ($iterator->valid()) { $iterator->next(); } }