protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $this->drop = $input->getOption('drop'); $this->skip_check = $input->getOption('skip-exists-check'); $this->check($input, $output); if ($this->drop) { $this->_executeSQL(sprintf("DROP DATABASE IF EXISTS `%s`", $this->target_db)); } $result = $this->_executeSQL(sprintf("CREATE DATABASE IF NOT EXISTS `%s` CHARACTER SET utf8", $this->target_db)); if (!empty($result)) { throw new \RuntimeException(sprintf('Cannot create database %s. Error: %s', $this->target_db, $result)); } $imports = $this->_getSQLFiles($input, $output); foreach ($imports as $import) { $tmp = tempnam('/tmp', 'dump'); $contents = file_get_contents($import); $contents = str_replace('#__', 'j_', $contents); file_put_contents($tmp, $contents); $password = empty($this->mysql->password) ? '' : sprintf("-p'%s'", $this->mysql->password); $result = exec(sprintf("mysql --host=%s --user='******' %s %s < %s", $this->mysql->host, $this->mysql->user, $password, $this->target_db, $tmp)); unlink($tmp); if (!empty($result)) { throw new \RuntimeException(sprintf('Cannot import database "%s". Error: %s', basename($import), $result)); } } }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $this->check($input, $output); $this->deleteDirectory($input, $output); $this->deleteVirtualHost($input, $output); $this->deleteDatabase($input, $output); }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $this->check($input, $output); $result = $this->_executeSQL(sprintf("DROP DATABASE IF EXISTS `%s`", $this->target_db)); if (!empty($result)) { throw new \RuntimeException(sprintf('Cannot drop database %s. Error: %s', $this->target_db, $result)); } }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); if ($input->getOption('interactive')) { $this->_promptDatabaseDetails($input, $output); } $this->symlink = $input->getOption('symlink'); if (is_string($this->symlink)) { $this->symlink = explode(',', $this->symlink); } $this->check($input, $output); $this->importdb($input, $output); $this->createConfig($input, $output); if ($this->symlink) { $this->symlinkProjects($input, $output); $this->installExtensions($input, $output); } $this->_enableWebInstaller($input, $output); $name = Util::isPlatform($this->target_dir) ? 'Joomla Platform application' : 'Joomla site'; $output->writeln("Your new {$name} has been configured."); $output->writeln("You can login using the following username and password combination: <info>admin</info>/<info>admin</info>."); }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $this->version = $input->getOption('release'); $this->check($input, $output); `mkdir -p {$this->target_dir}`; $this->download($input, $output); $this->addVirtualHost($input, $output); if ($this->version != 'none') { $arguments = array('site:install', 'site' => $this->site, '--www' => $this->www); $optionalArgs = array('sample-data', 'symlink', 'projects-dir', 'interactive', 'mysql-login', 'mysql_db_prefix', 'mysql-host', 'mysql-database'); foreach ($optionalArgs as $optionalArg) { $value = $input->getOption($optionalArg); if (!empty($value)) { $arguments['--' . $optionalArg] = $value; } } $command = new Install(); $command->setApplication($this->getApplication()); $command->run(new ArrayInput($arguments), $output); } }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $random = function ($length) { $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $string = ''; $count = strlen($charset); while ($length--) { $string .= $charset[mt_rand(0, $count - 1)]; } return $string; }; $this->_default_values = array('log_path' => $this->target_dir . '/logs/', 'tmp_path' => $this->target_dir . '/tmp/', 'sitename' => $this->site, 'key' => $random(16), 'env' => 'development'); if ($input->getOption('interactive')) { $this->_promptDetails($input, $output); } $this->check($input, $output); if (Util::isPlatform($this->target_dir)) { $this->_configureJoomlaPlatform(); } else { $this->_configureJoomlaCMS(); } }