/**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $logger = new ConsoleLogger($output);
     $updater = new Updater(null, false, Updater::STRATEGY_GITHUB);
     /** @var GithubStrategy $strategy */
     $strategy = $updater->getStrategy();
     $strategy->setPackageName(PharTool::PACKAGE_NAME);
     $strategy->setPharName(PharTool::PHAR_NAME);
     $strategy->setCurrentLocalVersion('@package_version@');
     $stability = $input->getOption('stability');
     $strategy->setStability($stability);
     try {
         if ($updater->hasUpdate()) {
             $newVersion = $updater->getNewVersion();
             $logger->info(sprintf('The current stable version available is: %s', $newVersion));
             $logger->info('Updating...');
             if ($updater->update()) {
                 $logger->info(sprintf('Successful! You now have version %s installed', $newVersion));
             }
         } elseif (false === $updater->getNewVersion()) {
             $logger->alert('There is no stable version available.');
         } else {
             $logger->info('@package_version@ is the latest stable version.');
         }
         return 0;
     } catch (HttpRequestException $e) {
         $logger->alert('Error fetching current version from remote repository.');
         return 1;
     }
 }
예제 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $methodArg = $input->getArgument('method');
     $apiOption = $input->getOption('api');
     $params = array();
     if ($input->hasOption('params')) {
         parse_str($input->getOption('params'), $params);
     }
     $this->logger = new ConsoleLogger($output);
     $method = $this->getMethod($methodArg, $apiOption);
     $this->logger->info("Calling api...");
     $this->logger->info("- method: " . $method->name());
     $this->logger->info("- url: " . $method->url());
     if ($params) {
         $this->logger->info("- extra params: ");
         $this->logger->info(var_export($params, true));
     }
     $response = $method->call($params);
     $this->logger->info('Finished');
     if ($input->getOption('show-response') && $response instanceof ResponseInterface) {
         $this->logger->info('Response:');
         $this->logger->info("- status code: " . $response->getStatusCode());
         $this->logger->info("- body: " . $response->getBody()->getContents());
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $logger = new ConsoleLogger($output);
     $updater = new Updater(null, false, Updater::STRATEGY_GITHUB);
     /** @var GithubStrategy $strategy */
     $strategy = $updater->getStrategy();
     $strategy->setPackageName('icehawk/component-template-generator');
     $strategy->setPharName('icehawk-ctg.phar');
     $strategy->setCurrentLocalVersion('@package_version@');
     $stability = $input->getOption('stability');
     $strategy->setStability($stability);
     if ($updater->hasUpdate()) {
         $newVersion = $updater->getNewVersion();
         $logger->info(sprintf('The current stable version available is: %s', $newVersion));
         $logger->info('Updating...');
         if ($updater->update()) {
             $logger->info(sprintf('Successful! You now have version %s installed', $newVersion));
         }
     } elseif (false === $updater->getNewVersion()) {
         $logger->alert('There is no stable version available.');
     } else {
         $logger->info('@package_version@ is the latest stable version.');
     }
     return 0;
 }
예제 #4
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $logger = new ConsoleLogger($output, self::VERBOSITY_LEVEL_MAP);
     $timestamp = ($timestamp = $input->getArgument('timestamp')) ? intval($timestamp) : null;
     $users = $this->getContainer()->get('bdn_connector')->updateCommunityUsers($timestamp);
     if (!empty($users['new'])) {
         foreach ($users['new'] as $user) {
             $logger->info('Added new user: '******'updated'])) {
         foreach ($users['updated'] as $user) {
             $logger->info('Updated user: ' . $user);
         }
     }
 }
예제 #5
0
 /**
  * Instantiate the tasks to process.
  *
  * @param ConfigurationValues $config The configuration values.
  *
  * @return Filter
  *
  * @throws \InvalidArgumentException When an unknown filter type has been configured.
  */
 private function buildFilters($config)
 {
     $collections = [];
     foreach ($config->get('rewrites') as $filterConfig) {
         $filters = [];
         foreach ($filterConfig['filter'] as $filter) {
             $this->logger->info('instantiate filter ' . $filter['type']);
             switch ($filter['type']) {
                 case 'replace':
                     $filters[] = new Filter\ReplaceStringFilter($filter);
                     break;
                 case 'php-strip':
                     $filters[] = new Filter\PhpStripWhiteSpaceFilter($filter);
                     break;
                 case 'warning-time':
                     $filters[] = new Filter\ReplaceStringWithTimestamp($filter);
                     break;
                 default:
                     throw new \InvalidArgumentException('Unknown filter type: ' . $filter['type']);
             }
         }
         $collections[] = new Filter\Collection($filterConfig['files'], $filters);
     }
     return new Filter($collections);
 }
예제 #6
0
 /**
  * deleteStandByAnnonce
  * 
  * This method delete the annonce that a left in standby status by the passerelle's process. 
  * It's mean that they are not present in the XML source anymore. The images associated with the annonce are deleted two. 
  *
  * @param void
  */
 private function deleteStandByAnnonce()
 {
     $this->oLogger->info("Delete Annonce still in standby");
     $aAnnonceEntities = $this->oEm->getRepository('JLPCoreBundle:Annonce')->findBy(array('statusAnnonce' => 'standby'));
     $this->iNbAnnonceSuppr = count($aAnnonceEntities);
     foreach ($aAnnonceEntities as $oAnnonce) {
         $aImagesCollection = $oAnnonce->getImages();
         $this->deleteImages($aImagesCollection);
         $this->oEm->remove($oAnnonce);
     }
     $this->oEm->flush();
 }
예제 #7
0
 /**
  * @param ConsoleLogger $logger
  * @param Config $config
  */
 public function logServerConfig(ConsoleLogger $logger, Config $config)
 {
     $logger->info("* config port       :" . $config->getPort());
     $logger->info("* config log_file   :" . $config->getLogFile());
     $logger->info("* config pid_file   :" . $config->getPidFile());
     $logger->info("* config classpaths :" . implode(',', $config->getClasspaths()));
     $logger->info("* config java_bin   :" . $config->getJavaBin());
     $logger->info("* config server_jar :" . $config->getServerJar());
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $logger = new ConsoleLogger($output);
     $updater = new Updater(null, false, Updater::STRATEGY_GITHUB);
     /** @var GithubStrategy $strategy */
     $strategy = $updater->getStrategy();
     $strategy->setPackageName('icehawk/component-template-generator');
     $strategy->setPharName('icehawk-ctg.phar');
     $strategy->setCurrentLocalVersion('@package_version@');
     if ($updater->rollback()) {
         $logger->info('Roll back successful!');
     } else {
         $logger->alert('Roll back failed.');
     }
     return 0;
 }
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $input->validate();
     $logger = new ConsoleLogger($output);
     $updater = new Updater(null, false, Updater::STRATEGY_GITHUB);
     /** @var GithubStrategy $strategy */
     $strategy = $updater->getStrategy();
     $strategy->setPackageName(PharTool::PACKAGE_NAME);
     $strategy->setPharName(PharTool::PHAR_NAME);
     $strategy->setCurrentLocalVersion('@package_version@');
     if ($updater->rollback()) {
         $logger->info('Roll back successful!');
     } else {
         $logger->alert('Roll back failed.');
     }
     return 0;
 }