| | |
| | | * End Form configuration |
| | | ******************************************/ |
| | | |
| | | require_once('../../lib/config.inc.php'); |
| | | require_once('../../lib/app.inc.php'); |
| | | require_once '../../lib/config.inc.php'; |
| | | require_once '../../lib/app.inc.php'; |
| | | |
| | | //* Check permissions for module |
| | | $app->auth->check_module_permissions('vm'); |
| | | if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied'); |
| | | |
| | | // Loading classes |
| | | $app->uses('tpl,tform'); |
| | | $app->load('tform_actions'); |
| | | |
| | | class page_action extends tform_actions { |
| | | |
| | | |
| | | 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); |
| | | global $app, $conf; |
| | | |
| | | $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); |
| | | global $app, $conf; |
| | | |
| | | $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 . ':' . $guar_ram, $guar_ram . ':' . $guar_ram, $burst_ram . ':' . $burst_ram, $this->id); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | $page = new page_action; |
| | | $page->onLoad(); |
| | | |
| | | ?> |
| | | ?> |