mirror of
				https://github.com/pluginsGLPI/example.git
				synced 2025-11-03 21:14:53 +01:00 
			
		
		
		
	cleanup of notification on uninstall
git-svn-id: https://forge.glpi-project.org/svn/example/trunk@138 349b9182-4a13-0410-896f-e5e9767dd1b3
This commit is contained in:
		
							
								
								
									
										8
									
								
								hook.php
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								hook.php
									
									
									
									
									
								
							@@ -656,6 +656,14 @@ function plugin_example_install() {
 | 
			
		||||
function plugin_example_uninstall() {
 | 
			
		||||
   global $DB;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   $notif = new Notification();
 | 
			
		||||
   $options = array('itemtype' => 'Ticket',
 | 
			
		||||
                    'event'    => 'plugin_example',
 | 
			
		||||
                    'FIELDS'   => 'id');
 | 
			
		||||
   foreach ($DB->request('glpi_notifications', $options) as $data) {
 | 
			
		||||
      $notif->delete($data);
 | 
			
		||||
   }
 | 
			
		||||
   // Old version tables
 | 
			
		||||
   if (TableExists("glpi_dropdown_plugin_example")) {
 | 
			
		||||
      $query = "DROP TABLE `glpi_dropdown_plugin_example`";
 | 
			
		||||
 
 | 
			
		||||
@@ -105,6 +105,7 @@ function plugin_init_example() {
 | 
			
		||||
   $PLUGIN_HOOKS['item_restore']['example']     = array('Computer'=>'plugin_item_restore_example');
 | 
			
		||||
 | 
			
		||||
   // Add event to GLPI core itemtype, event will be raised by the plugin.
 | 
			
		||||
   // See plugin_example_uninstall for cleanup of notification
 | 
			
		||||
   $PLUGIN_HOOKS['item_get_events']['example'] = array('NotificationTargetTicket'=>'plugin_example_add_event');
 | 
			
		||||
 | 
			
		||||
   $PLUGIN_HOOKS['item_transfer']['example'] = 'plugin_item_transfer_example';
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user