/** * @see vendor/symfony/src/Symfony/Component/Console/Command/Symfony\Component\Console\Command.Command::execute() */ protected function execute(InputInterface $input, OutputInterface $output) { $this->preExecute($input, $output); // set the path where magento should get installed $target = $this->validateTarget($this->config->getTarget()); // empty target directory if it already exists if (file_exists($target)) { Logger::comment('Delete existing Magento at %s', array($target)); exec(sprintf('rm -rf %s/*', $target)); exec(sprintf('rm -rf %s/.[a-zA-Z0-9]*', $target)); } // set the source where magento should get retrieved from $source = $this->config->getMagentoSource(); // copy files from source to target $this->installMagento($source, $target, $this->config->getMagentoBranch()); // move installed files to docroot $this->moveToDocroot($target, 'htdocs'); $this->moveToDocroot($target, 'magento'); Logger::success('Fetched Magento sources'); // create empty database with credentials from ini file if (false === $this->createDatabase($this->config->getDbName())) { throw new Exception('Could not create live database'); } // install sample data if (null !== $this->config->getMagentoSampledataSource()) { $this->installSampledata($this->config->getMagentoSampledataSource(), $target, $this->config->getMagentoSampledataBranch()); Logger::success('Installed sample data'); } // run install.php $this->runMageScript($target); // clean cache exec(sprintf('rm -rf %s/var/cache/*', $target)); Logger::success('Finished Magento installation'); }