From edaa7c5d66ef52eec1c15f79ae4034fc3e67b9b7 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 25 Oct 2012 10:29:39 -0400
Subject: [PATCH] - Fixed: FS#2502 - Problem in web traffic accounting for large integers - Added intval function from interface functions library to server system library.

---
 server/plugins-available/aps_plugin.inc.php |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/server/plugins-available/aps_plugin.inc.php b/server/plugins-available/aps_plugin.inc.php
index 26ae9be..ddeca3d 100644
--- a/server/plugins-available/aps_plugin.inc.php
+++ b/server/plugins-available/aps_plugin.inc.php
@@ -28,7 +28,7 @@
 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-require_once(ISPC_ROOT_PATH.'/lib/classes/aps_installer.inc.php');
+if(defined('ISPC_ROOT_PATH')) include_once(ISPC_ROOT_PATH.'/lib/classes/aps_installer.inc.php');
 //require_once(ISPC_ROOT_PATH.'/lib/classes/class.installer.php');
 
 class aps_plugin
@@ -57,7 +57,7 @@
         global $app;
         
         // Register the available events
-        $app->plugins->registerEvent('aps_instance_install', $this->plugin_name, 'install');
+        $app->plugins->registerEvent('aps_instance_insert', $this->plugin_name, 'install');
         $app->plugins->registerEvent('aps_instance_update', $this->plugin_name, 'install');
         $app->plugins->registerEvent('aps_instance_delete', $this->plugin_name, 'delete');
     }
@@ -78,6 +78,12 @@
 			$app->log("Running installHandler",LOGLEVEL_DEBUG);
 			$aps->installHandler($instanceid, 'install');
 		}
+		
+		if($data['new']['instance_status'] == INSTANCE_REMOVE) {
+			$aps = new ApsInstaller($app);
+			$app->log("Running installHandler",LOGLEVEL_DEBUG);
+			$aps->installHandler($instanceid, 'delete');
+		}
     }
     
     /**

--
Gitblit v1.9.1