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