| | |
| | | //* 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'); |
| | | } |
| | | |
| | | /* |
| | |
| | | |
| | | } |
| | | |
| | | 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; |
| | | |
| | |
| | | $app->load('tform_actions'); |
| | | |
| | | class page_action extends tform_actions { |
| | | |
| | | function onAfterDelete() { |
| | | global $app, $conf; |
| | | |
| | | //* Release all IP addresses which are assigned to this VM |
| | | $app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = '".$this->id."'"); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | <?php |
| | | |
| | | /* |
| | | Copyright (c) 2009, Till Brehm, projektfarm Gmbh |
| | | Copyright (c) 2011, Till Brehm, projektfarm Gmbh |
| | | All rights reserved. |
| | | |
| | | Redistribution and use in source and binary forms, with or without modification, |