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.

43 lines
1005 B

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. // index for vhosts
  18. const VHOST_INDEX = 0;
  19. /**
  20. *
  21. * @param CliMenu $menu [description]
  22. * @return [type] [description]
  23. */
  24. public function __invoke(CliMenu $menu): void
  25. {
  26. $parent = $menu->getParent();
  27. $menu->closeThis();
  28. // check for parent if exists, get parent
  29. if ($parent->getParent()) {
  30. $menu = $parent->getParent();
  31. } else {
  32. $menu = $parent;
  33. }
  34. $menu = NginxVhostFactory::addVhosts($menu, NginxVhost::find(), self::VHOST_INDEX);
  35. $menu->open();
  36. }
  37. }