|
@ -10,8 +10,9 @@ use PhpSchool\CliMenu\MenuItem\MenuMenuItem; |
|
|
class NginxVhostFactory |
|
|
class NginxVhostFactory |
|
|
{ |
|
|
{ |
|
|
/** |
|
|
/** |
|
|
|
|
|
* adding Vhosts behind index |
|
|
* |
|
|
* |
|
|
* @param [type] $mainmenu |
|
|
|
|
|
|
|
|
* @param [type] $mainmenu |
|
|
* @param [type] $vhosts |
|
|
* @param [type] $vhosts |
|
|
* @param [type] $vhostIndex |
|
|
* @param [type] $vhostIndex |
|
|
*/ |
|
|
*/ |
|
@ -31,7 +32,7 @@ class NginxVhostFactory |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// check for linebreak
|
|
|
|
|
|
|
|
|
// check for linebreak-object
|
|
|
foreach($items as $index => $item) { |
|
|
foreach($items as $index => $item) { |
|
|
if ($index > $vhostIndex && get_class($item) === 'PhpSchool\CliMenu\MenuItem\LineBreakItem') { |
|
|
if ($index > $vhostIndex && get_class($item) === 'PhpSchool\CliMenu\MenuItem\LineBreakItem') { |
|
|
$startIndex = $index; |
|
|
$startIndex = $index; |
|
@ -57,6 +58,7 @@ class NginxVhostFactory |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|
|
|
* |
|
|
* |
|
|
* |
|
|
* @param [type] $vhost |
|
|
* @param [type] $vhost |
|
|
* @param [type] $mainmenu |
|
|
* @param [type] $mainmenu |
|
@ -77,6 +79,7 @@ class NginxVhostFactory |
|
|
$builder |
|
|
$builder |
|
|
->setTitle('Nginx > '.$vhost['domain']) |
|
|
->setTitle('Nginx > '.$vhost['domain']) |
|
|
->setGoBackButtonText('Back') |
|
|
->setGoBackButtonText('Back') |
|
|
|
|
|
->addLineBreak('') |
|
|
->addItem('edit', function(CliMenu $menu) use ($vhost) { |
|
|
->addItem('edit', function(CliMenu $menu) use ($vhost) { |
|
|
system('nano /etc/nginx/sites-available/'.$vhost['file'].' > `tty`'); |
|
|
system('nano /etc/nginx/sites-available/'.$vhost['file'].' > `tty`'); |
|
|
}) |
|
|
}) |
|
@ -101,6 +104,7 @@ class NginxVhostFactory |
|
|
->addLineBreak('-'); |
|
|
->addLineBreak('-'); |
|
|
|
|
|
|
|
|
$submenu = $builder->build(); |
|
|
$submenu = $builder->build(); |
|
|
|
|
|
|
|
|
$submenu->setParent($mainmenu); |
|
|
$submenu->setParent($mainmenu); |
|
|
$submenu->setStyle($mainmenu->getStyle()); |
|
|
$submenu->setStyle($mainmenu->getStyle()); |
|
|
|
|
|
|
|
@ -110,6 +114,12 @@ class NginxVhostFactory |
|
|
$builder->isMenuDisabled() |
|
|
$builder->isMenuDisabled() |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
// show item extra if domain is enabled
|
|
|
|
|
|
$item->getStyle()->setItemExtra('[ enabled ]'); |
|
|
|
|
|
if ($vhost['enabled']) { |
|
|
|
|
|
$item->showItemExtra(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return $item; |
|
|
return $item; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|