/** * Remove mreporting notifications from GLPI. * * @return array 'success' => true on success */ static function uninstall() { global $DB; $queries = array(); // Remove NotificationTargets and Notifications $notification = new Notification(); $result = $notification->find("itemtype = 'PluginMreportingNotification'"); foreach ($result as $row) { $notification_id = $row['id']; $queries[] = "DELETE FROM glpi_notificationtargets \n WHERE notifications_id = " . $notification_id; $queries[] = "DELETE FROM glpi_notifications \n WHERE id = " . $notification_id; } // Remove NotificationTemplateTranslations and NotificationTemplates $template = new NotificationTemplate(); $result = $template->find("itemtype = 'PluginMreportingNotification'"); foreach ($result as $row) { $template_id = $row['id']; $queries[] = "DELETE FROM glpi_notificationtemplatetranslations \n WHERE notificationtemplates_id = " . $template_id; $queries[] = "DELETE FROM glpi_notificationtemplates \n WHERE id = " . $template_id; } foreach ($queries as $query) { $DB->query($query); } return array('success' => true); }