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'); } /** * (Re-)install a package */ public function install($event_name, $data) { global $app, $conf; //* dont run the installer on a mirror server to prevent // that the pplication gets installed twice. if($conf['mirror_server_id'] > 0) return true; $app->log("Starting APS install", LOGLEVEL_DEBUG); if(!isset($data['new']['id'])) return false; $instanceid = $data['new']['id']; if($data['new']['instance_status'] == INSTANCE_INSTALL) { $aps = new ApsInstaller($app); $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'); } } /** * Update an existing instance (currently unused) */ /* public function update($event_name, $data) { } */ /** * Uninstall an instance */ public function delete($event_name, $data) { global $app, $conf; if(!isset($data['new']['id'])) return false; $instanceid = $data['new']['id']; if($data['new']['instance_status'] == INSTANCE_REMOVE) { $aps = new ApsInstaller($app); $aps->installHandler($instanceid, 'install'); } } } ?>