From 0732d32f508045da40fe9df607b9ef20ce2d198f Mon Sep 17 00:00:00 2001 From: xaver <xaver@ispconfig3> Date: Tue, 06 Mar 2012 10:03:23 -0500 Subject: [PATCH] join fix - disappered in commit + Switch traffic joins, because its faster - Tested in a productive system (MySQL 5.1) as query few tausend domains 1-3 sec for Webtraffic sort, faster SQL = faster and MySQL 5.5 is much faster with joins (standard is not sorted with slow traffic querys) -> slowest part is coping the tables into temp -> more tweeks on cache... -> faster by heavy use --- interface/lib/plugins/vm_openvz_plugin.inc.php | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/interface/lib/plugins/vm_openvz_plugin.inc.php b/interface/lib/plugins/vm_openvz_plugin.inc.php index 1112e08..b1ce8e6 100644 --- a/interface/lib/plugins/vm_openvz_plugin.inc.php +++ b/interface/lib/plugins/vm_openvz_plugin.inc.php @@ -23,6 +23,7 @@ //* Register for events $app->plugin->registerEvent('vm:openvz_vm:on_after_insert','vm_openvz_plugin','openvz_vm_insert'); $app->plugin->registerEvent('vm:openvz_vm:on_after_update','vm_openvz_plugin','openvz_vm_update'); + $app->plugin->registerEvent('vm:openvz_vm:on_after_delete','vm_openvz_plugin','openvz_vm_delete'); } /* @@ -105,6 +106,16 @@ } + function openvz_vm_delete($event_name, $page_form) { + global $app, $conf; + + //* Free the IP address + $tmp = $app->db->queryOneRecord("SELECT ip_address_id FROM openvz_ip WHERE vm_id = ".$page_form->id); + $app->db->datalogUpdate('openvz_ip', 'vm_id = 0', 'ip_address_id', $tmp['ip_address_id']); + unset($tmp); + + } + private function applyTemplate() { global $app, $conf; @@ -129,13 +140,14 @@ private function makeOpenVZConfig() { global $app, $conf; - $vm = $app->tform->getDataRecord($this->id); + $vm = $app->db->queryOneRecord("SELECT * FROM openvz_vm WHERE vm_id = ".$this->id); $vm_template = $app->db->queryOneRecord("SELECT * FROM openvz_template WHERE template_id = ".$vm['template_id']); $burst_ram = $vm['ram_burst']*256; $guar_ram = $vm['ram']*256; + $app->load('tpl'); $tpl = new tpl(); - $tpl->newTemplate('templates/openvz.conf.tpl'); + $tpl->newTemplate('../vm/templates/openvz.conf.tpl'); $onboot = ($vm['start_boot'] == 'y')?'yes':'no'; $tpl->setVar('onboot',$onboot); @@ -194,7 +206,7 @@ private function createDNS() { global $app, $conf; - $vm = $app->tform->getDataRecord($this->id); + $vm = $app->db->queryOneRecord("SELECT * FROM openvz_vm WHERE vm_id = ".$this->id); if($vm['create_dns'] != 'y') return; -- Gitblit v1.9.1