Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     if (is_dir('/etc/apache2/sites-available')) {
         $site = $input->getArgument('site');
         $port = $input->getOption('http-port');
         $path = realpath(__DIR__ . '/../../../../../bin/.files/');
         $tmp = '/tmp/vhost.tmp';
         $template = file_get_contents($path . '/vhost.conf');
         $documentroot = Util::isPlatform($this->target_dir) ? $this->target_dir . '/web/' : $this->target_dir;
         file_put_contents($tmp, sprintf($template, $site, $documentroot, $port));
         if (!$input->getOption('disable-ssl')) {
             $ssl_crt = $input->getOption('ssl-crt');
             $ssl_key = $input->getOption('ssl-key');
             $ssl_port = $input->getOption('ssl-port');
             if (file_exists($ssl_crt) && file_exists($ssl_key)) {
                 $template = "\n\n" . file_get_contents($path . '/vhost.ssl.conf');
                 file_put_contents($tmp, sprintf($template, $site, $documentroot, $ssl_port, $ssl_crt, $ssl_key), FILE_APPEND);
             } else {
                 $output->writeln('<comment>SSL was not enabled for the site. One or more certificate files are missing.</comment>');
             }
         }
         `sudo tee /etc/apache2/sites-available/1-{$site}.conf < {$tmp}`;
         `sudo a2ensite 1-{$site}.conf`;
         `sudo /etc/init.d/apache2 restart > /dev/null 2>&1`;
         @unlink($tmp);
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->extensions = $input->getArgument('extensions');
     $this->check($input, $output);
     $this->uninstall($input, $output);
 }
Example #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     Bootstrapper::getApplication($this->target_dir);
     $this->_user_column = $input->getOption('user-column');
     $this->_date_column = $input->getOption('date-column');
     $dbo = \JFactory::getDbo();
     $prefix = \JFactory::getApplication()->get('dbprefix');
     $nullDate = $dbo->getNullDate();
     $tables = $this->_getTables();
     if ($input_tables = $input->getArgument('tables')) {
         $tables = array_intersect($tables, $input_tables);
     }
     if (empty($tables)) {
         $output->writeln("<comment>Nothing to check in</comment>");
     }
     foreach ($tables as $table) {
         $output->write("<comment>Checking in the {$table} table ... </comment>");
         $table = $prefix . $table;
         $query = $dbo->getQuery(true)->update($dbo->quoteName($table))->set(sprintf('%s = 0', $this->_user_column))->set(sprintf('%s = %s', $this->_date_column, $dbo->quote($nullDate)))->where(sprintf('%s > 0', $this->_user_column));
         $dbo->setQuery($query);
         if ($dbo->execute()) {
             $affected = $dbo->getAffectedRows();
             $format = '[<info>OK</info>] (%d %s checked in)';
             $message = sprintf($format, $affected, $affected == 1 ? 'row' : 'rows');
             $output->writeln("{$message}");
         } else {
             $output->writeln("[<error>FAILED</error>]");
         }
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->check($input, $output);
     Bootstrapper::getApplication($this->target_dir);
     $catalogue = \KObjectManager::getInstance()->getObject('com://admin/koowa.translator')->getCatalogue();
     $output->writeln($catalogue->getPrefix() . $catalogue->generateKey($input->getArgument('string')));
 }
Example #5
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->backup_directory = $input->getOption('directory');
     $this->check();
     $this->backupDatabase();
     $this->backupFiles();
 }
Example #6
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->app = Bootstrapper::getApplication($this->target_dir);
     // Load Library language
     $lang = \JFactory::getLanguage();
     // Try the finder_cli file in the current language (without allowing the loading of the file in the default language)
     $path = Util::isPlatform($this->target_dir) ? JPATH_SITE . '/components/com_finder' : JPATH_SITE;
     $lang->load('finder_cli', $path, null, false, false) || $lang->load('finder_cli', $path, null, true);
     // Fallback to the finder_cli file in the default language
     $this->check($input, $output);
     $this->purgeFinder($input, $output);
 }
Example #7
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->check($input, $output);
     require_once Util::buildTargetPath('libraries/koowa/libraries/koowa.php', $this->target_dir);
     require_once Util::buildTargetPath('configuration.php', $this->target_dir);
     \Koowa::getInstance();
     $config = new \JConfig();
     $secret = $config->secret;
     $user = $input->getArgument('username');
     $token = \KObjectManager::getInstance()->getObject('http.token')->setSubject($user)->sign($secret);
     $output->writeln($token);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     Bootstrapper::getApplication($this->target_dir);
     $this->url = $input->getOption('application-url');
     if ($this->url == 'http://localhost/<site>') {
         $this->url = 'http://localhost/' . $this->site . '/';
     }
     if (substr($this->url, -1) != '/') {
         $this->url .= '/';
     }
     $this->check($input, $output);
 }
Example #9
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->server = $input->getArgument('server');
     $this->user = $input->getOption('user');
     $this->password = $input->getOption('password');
     $this->check($input, $output);
     chdir($this->target_dir);
     $this->checkGit($input, $output);
     $initialised = $this->initGitFTP($input, $output);
     if (!$initialised) {
         $this->deploy();
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     if (!file_exists($this->target_dir . '/Capfile')) {
         `cap install`;
         `mkdir .capistrano`;
         `touch .capistrano/metrics`;
         `echo "none" > .capistrano/metrics`;
         $output->writeln('<info>Created blank Cap project</info>');
         $output->writeln('<comment>For installation and configuration help, please refer to the documentation:</comment>');
         $output->writeln('http://capistranorb.com/documentation/getting-started/installation/');
         return;
     } else {
         $result = exec('cd ' . $this->target_dir . '; cap ' . $input->getOption('environment') . ' deploy');
         $output->writeln($result);
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $db_name = $input->getOption('mysql-database');
     if (empty($db_name)) {
         $this->target_db_prefix = $input->getOption('mysql_db_prefix');
         $this->target_db = $this->target_db_prefix . $this->site;
     } else {
         $this->target_db_prefix = '';
         $this->target_db = $db_name;
     }
     $credentials = explode(':', $input->getOption('mysql-login'), 2);
     $this->mysql = (object) array('user' => $credentials[0], 'password' => $credentials[1], 'host' => $input->getOption('mysql-host'), 'driver' => strtolower($input->getOption('mysql-driver')));
     if (!in_array($this->mysql->driver, array('mysql', 'mysqli'))) {
         throw new \RuntimeException(sprintf('Invalid MySQL driver %s', $this->mysql->driver));
     }
 }
Example #12
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->symlink = $input->getArgument('symlink');
     if (count($this->symlink) == 1 && $this->symlink[0] == 'all') {
         $this->symlink = array();
         $source = $input->getOption('projects-dir') . '/*';
         foreach (glob($source, GLOB_ONLYDIR) as $directory) {
             $this->symlink[] = basename($directory);
         }
     }
     $this->projects = array();
     foreach ($this->symlink as $symlink) {
         $this->projects[] = $symlink;
         $this->projects = array_unique(array_merge($this->projects, $this->_getDependencies($symlink)));
     }
     $this->check($input, $output);
     $this->symlinkProjects($input, $output);
 }
Example #13
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->check($input, $output);
     $this->versions = new Versions();
     if ($input->getOption('repo')) {
         $this->versions->setRepository($input->getOption('repo'));
     }
     if ($input->getOption('refresh')) {
         $this->versions->refresh();
     }
     if ($input->getOption('clear-cache')) {
         $this->versions->clearcache($output);
     }
     $this->setVersion($input->getOption('release'));
     if ($this->version != 'none') {
         $tarball = $this->_getTarball($output);
         if (!$this->_isValidTarball($tarball)) {
             if (file_exists($tarball)) {
                 unlink($tarball);
             }
             throw new \RuntimeException(sprintf('Downloaded tarball "%s" could not be verified. A common cause is an interrupted download: check your internet connection and try again.', basename($tarball)));
         }
         if (!file_exists($this->target_dir)) {
             `mkdir -p {$this->target_dir}`;
         }
         `cd {$this->target_dir}; tar xzf {$tarball} --strip 1`;
         if ($this->versions->isBranch($this->version)) {
             unlink($tarball);
         }
         $isPlatform = Util::isPlatform($this->target_dir);
         $directory = $this->target_dir . ($isPlatform ? '/web' : '');
         if (file_exists($directory . '/htaccess.txt')) {
             `cp {$directory}/htaccess.txt {$directory}/.htaccess`;
         }
         if ($isPlatform) {
             `cd {$this->target_dir}; composer install -q`;
         }
     }
 }
Example #14
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->check($input, $output);
     $this->versions = new Versions();
     if ($input->getOption('repo')) {
         $this->versions->setRepository($input->getOption('repo'));
     }
     if ($input->getOption('refresh')) {
         $this->versions->refresh();
     }
     if ($input->getOption('clear-cache')) {
         $this->versions->clearcache($output);
     }
     $this->setVersion($input->getOption('release'));
     if ($this->version != 'none') {
         $tarball = $this->_getTarball($output);
         if (!file_exists($tarball)) {
             throw new \RuntimeException(sprintf('File %s does not exist', $tarball));
         }
         if (!file_exists($this->target_dir)) {
             `mkdir -p {$this->target_dir}`;
         }
         `cd {$this->target_dir}; tar xzf {$tarball} --strip 1`;
         if ($this->versions->isBranch($this->version)) {
             unlink($tarball);
         }
         $isPlatform = Util::isPlatform($this->target_dir);
         $directory = $this->target_dir . ($isPlatform ? '/web' : '');
         if (file_exists($directory . '/htaccess.txt')) {
             `cp {$directory}/htaccess.txt {$directory}/.htaccess`;
         }
         if ($isPlatform) {
             `cd {$this->target_dir}; composer install -q`;
         }
     }
 }