public function getLinkForVhost($vhostName)
 {
     $baseDir = $this->globalConfiguration->getVhostsDirectory();
     if (!is_dir($baseDir)) {
         throw new NotADirectoryException($baseDir);
     }
     $linkName = $baseDir . '/' . $vhostName;
     if (!is_link($linkName) && file_exists($linkName)) {
         throw new NotALinkException($linkName);
     }
     return $linkName;
 }
 public function setDisabled($disabled)
 {
     if ($disabled) {
         $this->globalConfiguration->setConfigOption(['vhosts', $this->getName(), 'disabled'], true);
     } else {
         $this->globalConfiguration->removeConfigOption(['vhosts', $this->getName(), 'disabled']);
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configHelper = $this->getHelper('configuration');
     /* @var $configHelper GlobalConfigurationHelper */
     $clicDir = $input->getOption('clic-dir');
     if (!$clicDir) {
         $clicDir = $configHelper->getConfiguration()->getClicDirectory();
     }
     $backupFile = new \SplFileInfo($clicDir . '/settings-backup/' . sha1($configHelper->getConfigurationFile()->getPathname()) . '/' . $input->getArgument('version'));
     if (!$backupFile->isFile()) {
         throw new NotAFileException($backupFile);
     }
     try {
         $config = new GlobalConfiguration($backupFile);
         $config->getConfig();
     } catch (\Exception $ex) {
         $output->writeln(sprintf('<error>Cannot restore %s: %s</error>', $backupFile, $ex->getMessage()));
         return 1;
     }
     FsUtil::file_put_contents($configHelper->getConfigurationFile(), FsUtil::file_get_contents($backupFile));
     $output->writeln(sprintf('Restored %s to version %s', $configHelper->getConfigurationFile(), $backupFile->getRealPath()));
 }
 /**
  * @var VhostConfiguration[]
  */
 public function getVhosts()
 {
     return array_filter($this->globalConfiguration->getVhostConfigurations(), function (VhostConfiguration $vhostConfiguration) {
         return $vhostConfiguration->getApplication() === $this->getName();
     });
 }