OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

42 lines
980 B

<?php
namespace App\Menus\Nginx;
use PhpSchool\CliMenu\CliMenu;
use App\Facades\NginxVhost;
use App\Facades\NginxVhostFactory;
/**
* Action that override default-action for go back
* reload vhosts
*
* @author Björn Hase, Tentakelfabrik
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp
*
*/
class NginxVhostGoBackAction
{
const VHOST_INDEX = 0;
/**
*
* @param CliMenu $menu [description]
* @return [type] [description]
*/
public function __invoke(CliMenu $menu): void
{
$parent = $menu->getParent();
$menu->closeThis();
// check for parent if exists, get parent
if ($parent->getParent()) {
$menu = $parent->getParent();
} else {
$menu = $parent;
}
$menu = NginxVhostFactory::addVhosts($menu, NginxVhost::find(), self::VHOST_INDEX);
$menu->open();
}
}