Example #1
0
 /**
  * Execute the command.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return void
  * @throws \RuntimeException when Magento could not be initialized
  * @throws \RuntimeException when Magento could not deliver a proper core
  *   resource entity.
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->detectMagento($output, true);
     if (!$this->initMagento()) {
         throw new \RuntimeException('Could not initialize Magento!');
     }
     static $fetcher;
     if (!isset($fetcher)) {
         $fetcher = new HostNameFetcher();
     }
     $hostNames = $fetcher->getByConfig(\Mage::getConfig());
     foreach ($hostNames as $hostName) {
         $output->writeln($hostName);
     }
 }
Example #2
0
 /**
  * Execute the command.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return void
  * @throws \RuntimeException when Magento could not be initialized
  * @throws \RuntimeException when Magento could not deliver a proper core
  *   resource entity.
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $this->detectMagento($output, true);
     if (!$this->initMagento()) {
         throw new \RuntimeException('Could not initialize Magento!');
     }
     static $fetcher;
     if (!isset($fetcher)) {
         $fetcher = new HostNameFetcher();
     }
     $hostNames = array_values($fetcher->getByConfig(\Mage::getConfig()));
     foreach ($hostNames as $i => $hostName) {
         $directive = $i === 0 ? 'ServerName' : 'ServerAlias';
         $output->writeln("\t{$directive} {$hostName}");
         $output->writeln("\tServerAlias www.{$hostName}");
     }
 }
Example #3
0
 /**
  * Execute the command.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return void
  * @throws \InvalidArgumentException when the supplied server argument
  *   could not be resolved to an IP address.
  * @throws \RuntimeException when Magento could not be initialized
  * @throws \RuntimeException when Magento could not deliver a proper core
  *   resource entity.
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $host = $input->getArgument('server');
     $ipAddress = gethostbyname($host);
     if (!filter_var($ipAddress, FILTER_VALIDATE_IP)) {
         throw new \InvalidArgumentException("Could not resolve hostname to an IP: {$host} => {$ipAddress}");
     }
     $this->detectMagento($output, true);
     if (!$this->initMagento()) {
         throw new \RuntimeException('Could not initialize Magento!');
     }
     static $fetcher;
     if (!isset($fetcher)) {
         $fetcher = new HostNameFetcher();
     }
     $hostNames = $fetcher->getByConfig(\Mage::getConfig());
     foreach ($hostNames as $hostName) {
         $output->writeln("{$ipAddress}\t{$hostName} www.{$hostName}");
     }
 }