| | |
| | | |
| | | // Custom nginx directives |
| | | $final_nginx_directives = array(); |
| | | $nginx_directives = $data['new']['nginx_directives']; |
| | | if(intval($data['new']['directive_snippets_id']) > 0){ |
| | | $snippet = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ? AND type = 'nginx' AND active = 'y' AND customer_viewable = 'y'", intval($data['new']['directive_snippets_id'])); |
| | | if(isset($snippet['snippet'])){ |
| | | $nginx_directives = $snippet['snippet']; |
| | | } else { |
| | | $nginx_directives = $data['new']['nginx_directives']; |
| | | } |
| | | } else { |
| | | $nginx_directives = $data['new']['nginx_directives']; |
| | | } |
| | | // Make sure we only have Unix linebreaks |
| | | $nginx_directives = str_replace("\r\n", "\n", $nginx_directives); |
| | | $nginx_directives = str_replace("\r", "\n", $nginx_directives); |
| | |
| | | $this->awstats_delete($data, $web_config); |
| | | } |
| | | |
| | | //* Delete the web-backups |
| | | if($data['old']['type'] == 'vhost') { |
| | | $server_config = $app->getconf->get_server_config($conf['server_id'], 'server'); |
| | | $backup_dir = $server_config['backup_dir']; |
| | | $mount_backup = true; |
| | | if($server_config['backup_dir'] != '' && $server_config['backup_delete'] == 'y') { |
| | | //* mount backup directory, if necessary |
| | | if( $server_config['backup_dir_is_mount'] == 'y' && !$app->system->mount_backup_dir($backup_dir) ) $mount_backup = false; |
| | | if($mount_backup){ |
| | | $web_backup_dir = $backup_dir.'/web'.$data_old['domain_id']; |
| | | //** do not use rm -rf $web_backup_dir because database(s) may exits |
| | | exec(escapeshellcmd('rm -f '.$web_backup_dir.'/web'.$data_old['domain_id'].'_').'*'); |
| | | //* cleanup database |
| | | $sql = "DELETE FROM web_backup WHERE server_id = ? AND parent_domain_id = ? AND filename LIKE ?"; |
| | | $app->db->query($sql, $conf['server_id'], $data_old['domain_id'], "web".$data_old['domain_id']."_%"); |
| | | if($app->db->dbHost != $app->dbmaster->dbHost) $app->dbmaster->query($sql, $conf['server_id'], $data_old['domain_id'], "web".$data_old['domain_id']."_%"); |
| | | |
| | | $app->log('Deleted the web backup files', LOGLEVEL_DEBUG); |
| | | } |
| | | } |
| | | } |
| | | |
| | | $app->services->restartServiceDelayed('httpd', 'reload'); |
| | | |
| | | } |