From 6028e4692d172b63f8af79c4460f9dbff5a9a01c Mon Sep 17 00:00:00 2001 From: Marius Burkard <m.burkard@pixcept.de> Date: Thu, 26 May 2016 02:21:05 -0400 Subject: [PATCH] Merge branch 'master' into 'stable-3.1' --- interface/web/vm/openvz_template_edit.php | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/interface/web/vm/openvz_template_edit.php b/interface/web/vm/openvz_template_edit.php index 73d004e..c9c2400 100644 --- a/interface/web/vm/openvz_template_edit.php +++ b/interface/web/vm/openvz_template_edit.php @@ -54,19 +54,16 @@ function onAfterInsert() { global $app, $conf; - $guar_ram = $this->dataRecord['ram']*256; - $burst_ram = $this->dataRecord['ram_burst']*256; - $sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id"; - $app->db->query($sql); + $this->onAfterUpdate(); } function onAfterUpdate() { global $app, $conf; - $guar_ram = $this->dataRecord['ram']*256; - $burst_ram = $this->dataRecord['ram_burst']*256; - $sql = "UPDATE openvz_template SET shmpages = '$guar_ram:$guar_ram',vmguarpages = '$guar_ram:$guar_ram', oomguarpages = '$guar_ram:$guar_ram',privvmpages = '$burst_ram:$burst_ram' WHERE template_id = $this->id"; - $app->db->query($sql); + $guar_ram = $app->functions->intval($this->dataRecord['ram']*256); + $burst_ram = $app->functions->intval($this->dataRecord['ram_burst']*256); + $sql = "UPDATE openvz_template SET shmpages = ?,vmguarpages = ?, oomguarpages = ?,privvmpages = ? WHERE template_id = ?"; + $app->db->query($sql, $guar_ram . ':' . $guar_ram, $guar_ram . ':unlimited', $guar_ram . ':' . $guar_ram, $burst_ram . ':' . $burst_ram*1.0625, $this->id); } } -- Gitblit v1.9.1