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

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Menus\Nginx;
  3. use PhpSchool\CliMenu\CliMenu;
  4. use App\Facades\NginxVhost;
  5. use App\Facades\NginxVhostFactory;
  6. /**
  7. * Action that override default-action for go back
  8. * reload vhosts
  9. *
  10. * @author Björn Hase, Tentakelfabrik
  11. * @license http://opensource.org/licenses/MIT The MIT License
  12. * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp
  13. *
  14. */
  15. class NginxVhostGoBackAction
  16. {
  17. const VHOST_INDEX = 0;
  18. /**
  19. *
  20. * @param CliMenu $menu [description]
  21. * @return [type] [description]
  22. */
  23. public function __invoke(CliMenu $menu): void
  24. {
  25. $parent = $menu->getParent();
  26. $menu->closeThis();
  27. // check for parent if exists, get parent
  28. if ($parent->getParent()) {
  29. $menu = $parent->getParent();
  30. } else {
  31. $menu = $parent;
  32. }
  33. $menu = NginxVhostFactory::addVhosts($menu, NginxVhost::find(), self::VHOST_INDEX);
  34. $menu->open();
  35. }
  36. }