Skip to content

Commit

Permalink
#131 Fix template override
Browse files Browse the repository at this point in the history
  • Loading branch information
amazeika committed Feb 10, 2021
1 parent 1045c8b commit c8a9c90
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/Joomlatools/Console/Command/Vhost/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,25 +214,29 @@ protected function _getVariables(InputInterface $input)

protected function _getTemplate(InputInterface $input, $application = 'apache')
{
$path = realpath(__DIR__.'/../../../../../bin/.files/vhosts');

if ($template = $input->getOption(sprintf('%s-template', $application)))
{
if (file_exists($template)) {
return file_get_contents($template);
if (file_exists($template))
{
$file = basename($template);
$path = dirname($template);
}
else throw new \Exception(sprintf('Template file %s does not exist.', $template));
}

switch($application)
else
{
case 'nginx':
$file = Util::isKodekitPlatform($this->target_dir) ? 'nginx.kodekit.conf' : 'nginx.conf';
break;
case 'apache':
default:
$file = 'apache.conf';
break;
$path = realpath(__DIR__.'/../../../../../bin/.files/vhosts');

switch($application)
{
case 'nginx':
$file = Util::isKodekitPlatform($this->target_dir) ? 'nginx.kodekit.conf' : 'nginx.conf';
break;
case 'apache':
default:
$file = 'apache.conf';
break;
}
}

$template = file_get_contents(sprintf('%s/%s', $path, $file));
Expand Down

0 comments on commit c8a9c90

Please sign in to comment.