From 84710d22010a71c53ec7a2537b6899d29a31e13a Mon Sep 17 00:00:00 2001 From: tbrehm <t.brehm@ispconfig.org> Date: Mon, 02 Jan 2012 15:26:47 -0500 Subject: [PATCH] - Improved check for vhosts created with the remote API FS#1950 --- server/plugins-available/apache2_plugin.inc.php | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index e721a08..3cba835 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -1115,7 +1115,13 @@ if($apache_online_status_before_restart && !$apache_online_status_after_restart) { $app->log('Apache did not restart after the configuration change for website '.$data['new']['domain'].' Reverting the configuration. Saved non-working config as '.$vhost_file.'.err',LOGLEVEL_WARN); copy($vhost_file,$vhost_file.'.err'); - copy($vhost_file.'~',$vhost_file); + if(is_file($vhost_file.'~')) { + //* Copy back the last backup file + copy($vhost_file.'~',$vhost_file); + } else { + //* There is no backup file, so we create a empty vhost file with a warning message inside + file_put_contents($vhost_file,"# Apache did not start after modifying this vhost file.\n# Please check file $vhost_file.err for syntax errors."); + } $app->services->restartService('httpd','restart'); } } else { -- Gitblit v1.9.1