Browse Source

bugfix check message for nginx test

release/0.1
Björn 4 years ago
parent
commit
753b29b51e
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      app/Factories/NginxVhostFactory.php

+ 10
- 10
app/Factories/NginxVhostFactory.php View File

@ -168,9 +168,18 @@ class NginxVhostFactory
// check status // check status
if ($menu->getSelectedItem()->getChecked()) { if ($menu->getSelectedItem()->getChecked()) {
symlink('/etc/nginx/sites-available/'.$vhost['file'], '/etc/nginx/sites-enabled/'.$vhost['file']); symlink('/etc/nginx/sites-available/'.$vhost['file'], '/etc/nginx/sites-enabled/'.$vhost['file']);
exec('nginx -c /etc/nginx/nginx.conf -t 2>&1', $output); exec('nginx -c /etc/nginx/nginx.conf -t 2>&1', $output);
$result = preg_match_all("/syntax is ok/", implode(' ', $output), $output);
// restart if success message was found
if ($result > 0) {
exec('service nginx restart');
$menu->confirm('Success! ')->display('OK!');
if ($output) {
$vhost['enabled'] = true;
$status = 'enabled';
} else {
unlink('/etc/nginx/sites-enabled/'.$vhost['file']); unlink('/etc/nginx/sites-enabled/'.$vhost['file']);
$menu->confirm('Error! Configuration not Working!')->display('OK!'); $menu->confirm('Error! Configuration not Working!')->display('OK!');
@ -179,15 +188,6 @@ class NginxVhostFactory
$vhost['enabled'] = false; $vhost['enabled'] = false;
$status = 'disabled'; $status = 'disabled';
} else {
// restart
exec('service nginx restart');
$menu->confirm('Success! ')->display('OK!');
$vhost['enabled'] = true;
$status = 'enabled';
} }
} else { } else {
unlink('/etc/nginx/sites-enabled/'.$vhost['file']); unlink('/etc/nginx/sites-enabled/'.$vhost['file']);


Loading…
Cancel
Save