Beispiel #1
0
 public function execute()
 {
     $commands = $this->config->plugins->Cli->commands->toArray();
     foreach ($commands as $command) {
         $cmd = escapeshellcmd($command);
         Logger::comment("Running custom command: {$cmd}");
         exec($cmd);
     }
 }
Beispiel #2
0
 /**
  * Clone git repo to desired location
  */
 protected function _cloneRepository($repoUrl, $targetPath)
 {
     Logger::comment('Cloning Git repository');
     $command = sprintf('git clone %s %s 2>&1', $repoUrl, $targetPath);
     Logger::log($command);
     exec($command, $result, $return);
     if (0 !== $return) {
         throw new Exception(implode(PHP_EOL, $result));
     }
 }
Beispiel #3
0
 public function execute()
 {
     $settings = $this->config->plugins->Reindex;
     if ($settings instanceof \Zend_Config) {
         $processes = $this->_getProcesses($settings);
         foreach ($processes as $process) {
             $code = $process->getIndexer()->getName();
             /* @var $process Mage_Index_Model_Process */
             try {
                 Logger::comment('* rebuilding %s', array(trim($code)));
                 //$process->reindexEverything();
                 Logger::log('* Index <info>%s</info> was rebuilt successfully', array(trim($code)));
             } catch (Mage_Core_Exception $e) {
                 Logger::error('An error occured while rebuilding index %s: %s', array(trim($code), $e->getMessage()), false);
             } catch (Exception $e) {
                 Logger::error('A strange error occured while rebuilding index %s: %s', array(trim($code), $e->getMessage()), false);
             }
         }
     } else {
         Logger::error('Invalid configuration for plugin Reindex', array(), false);
     }
 }
Beispiel #4
0
 /**
  * @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);
     $this->initMagento();
     $plugins = $this->config->getPlugins();
     foreach ($plugins as $name => $settings) {
         // check if plugin was defined in ini, but disabled
         if ('0' === $settings->enabled) {
             Logger::log('Skipping plugin "%s"', array($name));
             continue;
         }
         // set path to plugin by convention
         $path = $this->getBasePath() . 'plugins' . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR;
         // load script file
         $file = $path . $name . '.php';
         if (!file_exists($file)) {
             Logger::error('Could not find plugin "%s"', array($name), $stop = false);
             Logger::log('Expected it at path "%s"', array($path));
             continue;
         }
         // load default jumpstorm config for plugin execution
         $pluginConfig = $this->config;
         $customIni = $settings->ini;
         if (null !== $customIni && file_exists($customIni)) {
             unset($settings->ini);
             // add custom config settings, if given
             $pluginConfig = new Config($customIni, null, array('allowModifications' => true));
             $pluginConfig->merge($this->config);
         }
         Logger::comment(sprintf('Running plugin "%s"', $name));
         $class = "{$name}\\{$name}";
         $plugin = new $class($pluginConfig);
         $plugin->execute();
         Logger::notice(sprintf('Finished running plugin "%s"', $name));
     }
     Logger::notice('Done');
 }
Beispiel #5
0
 /**
  * @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');
 }