function plugin_moreticket_uninstall() { global $DB; // Plugin tables deletion $tables = array("glpi_plugin_moreticket_configs", "glpi_plugin_moreticket_waitingtickets", "glpi_plugin_moreticket_waitingtypes", "glpi_plugin_moreticket_closetickets"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginMoreticketProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } return true; }
/** * @param $profile **/ static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) { $profileRight = new ProfileRight(); foreach ($rights as $right => $value) { if (countElementsInTable('glpi_profilerights', "`profiles_id`='{$profiles_id}' AND `name`='{$right}'") && $drop_existing) { $profileRight->deleteByCriteria(array('profiles_id' => $profiles_id, 'name' => $right)); } if (!countElementsInTable('glpi_profilerights', "`profiles_id`='{$profiles_id}' AND `name`='{$right}'")) { $myright['profiles_id'] = $profiles_id; $myright['name'] = $right; $myright['rights'] = $value; $profileRight->add($myright); //Add right to the current session $_SESSION['glpiactiveprofile'][$right] = $value; } } }
function plugin_consumables_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/consumables/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/consumables/inc/menu.class.php"; $tables = array("glpi_plugin_consumables_profiles", "glpi_plugin_consumables_requests"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $options = array('itemtype' => 'PluginConsumablesRequest', 'event' => 'ConsumableRequest', 'FIELDS' => 'id'); $notif = new Notification(); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginConsumablesRequest', 'event' => 'ConsumableResponse', 'FIELDS' => 'id'); $notif = new Notification(); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } //templates $template = new NotificationTemplate(); $translation = new NotificationTemplateTranslation(); $options = array('itemtype' => 'PluginConsumablesRequest', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplates', $options) as $data) { $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) { $translation->delete($data_template); } $template->delete($data); } // Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginConsumablesProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginConsumablesMenu::removeRightsFromSession(); PluginConsumablesProfile::removeRightsFromSession(); return true; }
function plugin_tasklists_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/tasklists/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/tasklists/inc/menu.class.php"; $tables = array("glpi_plugin_tasklists_tasks", "glpi_plugin_tasklists_tasktypes"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $tables_glpi = array("glpi_displaypreferences", "glpi_notepads", "glpi_bookmarks", "glpi_logs"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` LIKE 'PluginTasklistsTask%';"); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginTasklistsProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginTasklistsMenu::removeRightsFromSession(); PluginTasklistsProfile::removeRightsFromSession(); return true; }
/** * @param $reports **/ function updateRights($reports) { global $DB; $profile_right = new ProfileRight(); $rights = array(); foreach ($reports as $report => $plug) { if ($plug == 'reports') { $rights["plugin_reports_{$report}"] = 1; } else { $rights["plugin_reports_{$plug}_{$report}"] = 1; } } $current_rights = array(); $query = "SELECT DISTINCT `name`\n FROM `glpi_profilerights`\n WHERE `name` LIKE 'plugin_reports_%'"; foreach ($DB->request($query) as $data) { $current_rights[$data['name']] = 1; } // Remove old reports foreach ($current_rights as $right => $value) { if (!isset($rights[$right])) { // Delete the lines for old reports $profile_right->deleteByCriteria(array('name' => $right)); } else { unset($rights[$right]); } } /* // Add new reports $rights_name = array_keys($rights); ProfileRight::addProfileRights($rights_name); if ($_SESSION['glpiactiveprofile']['id'] == 4) { $profile_right->updateProfileRights(4, $rights); }*/ }
function plugin_badges_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/badges/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/badges/inc/menu.class.php"; $tables = array("glpi_plugin_badges_badges", "glpi_plugin_badges_badgetypes", "glpi_plugin_badges_configs", "glpi_plugin_badges_notificationstates", "glpi_plugin_badges_requests"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } //old versions $tables = array("glpi_plugin_badges", "glpi_dropdown_plugin_badges_type", "glpi_plugin_badges_users", "glpi_plugin_badges_profiles", "glpi_plugin_badges_config", "glpi_plugin_badges_mailing", "glpi_plugin_badges_default"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $notif = new Notification(); $options = array('itemtype' => 'PluginBadgesBadge', 'event' => 'ExpiredBadges', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginBadgesBadge', 'event' => 'BadgesWhichExpire', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginBadgesBadge', 'event' => 'BadgesReturn', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginBadgesBadge', 'event' => 'AccessBadgeRequest', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } //templates $template = new NotificationTemplate(); $translation = new NotificationTemplateTranslation(); $options = array('itemtype' => 'PluginBadgesBadge', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplates', $options) as $data) { $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) { $translation->delete($data_template); } $template->delete($data); } $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_items_tickets", "glpi_notepads", "glpi_dropdowntranslations"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` LIKE 'PluginBadges%';"); } if (class_exists('PluginDatainjectionModel')) { PluginDatainjectionModel::clean(array('itemtype' => 'PluginBadgesBadge')); } CronTask::Unregister('PluginBadgesReturn'); //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginBadgesProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginBadgesMenu::removeRightsFromSession(); PluginBadgesProfile::removeRightsFromSession(); return true; }
function plugin_additionalalerts_uninstall() { global $DB; $tables = array("glpi_plugin_additionalalerts_ocsalerts", "glpi_plugin_additionalalerts_infocomalerts", "glpi_plugin_additionalalerts_notificationstates", "glpi_plugin_additionalalerts_notificationtypes", "glpi_plugin_additionalalerts_configs"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } //old versions $tables = array("glpi_plugin_additionalalerts_reminderalerts", "glpi_plugin_alerting_config", "glpi_plugin_alerting_state", "glpi_plugin_alerting_profiles", "glpi_plugin_alerting_mailing", "glpi_plugin_alerting_type", "glpi_plugin_additionalalerts_profiles"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $notif = new Notification(); $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'event' => 'ocs', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'event' => 'newocs', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginAdditionalalertsInfocomAlert', 'event' => 'notinfocom', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } //templates $template = new NotificationTemplate(); $translation = new NotificationTemplateTranslation(); $options = array('itemtype' => 'PluginAdditionalalertsOcsAlert', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplates', $options) as $data) { $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) { $translation->delete($data_template); } $template->delete($data); } //templates $template = new NotificationTemplate(); $translation = new NotificationTemplateTranslation(); $options = array('itemtype' => 'PluginAdditionalalertsInfocomAlert', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplates', $options) as $data) { $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) { $translation->delete($data_template); } $template->delete($data); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginAdditionalalertsProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginAdditionalalertsProfile::removeRightsFromSession(); PluginAdditionalalertsMenu::removeRightsFromSession(); return true; }
function plugin_addressing_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/addressing/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/addressing/inc/menu.class.php"; $migration = new Migration("2.2.0"); $tables = array("glpi_plugin_addressing_addressings", "glpi_plugin_addressing_configs"); foreach ($tables as $table) { $migration->dropTable($table); } $itemtypes = array('DisplayPreference', 'Bookmark'); foreach ($itemtypes as $itemtype) { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => 'PluginAddressingAddressing')); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginAddressingProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } //Remove rigth from $_SESSION['glpiactiveprofile'] if exists PluginAddressingProfile::removeRightsFromSession(); PluginAddressingMenu::removeRightsFromSession(); return true; }
function plugin_racks_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/racks/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/racks/inc/menu.class.php"; $migration = new Migration("1.6.1"); $tables = array("glpi_plugin_racks_racks", "glpi_plugin_racks_racks_items", "glpi_plugin_racks_itemspecifications", "glpi_plugin_racks_rackmodels", "glpi_plugin_racks_roomlocations", "glpi_plugin_racks_connections", "glpi_plugin_racks_configs", "glpi_plugin_racks_others", "glpi_plugin_racks_othermodels", "glpi_plugin_racks_racktypes", "glpi_plugin_racks_rackstates"); foreach ($tables as $table) { $migration->dropTable($table); } //old versions $tables = array("glpi_plugin_rack", "glpi_plugin_rack_content", "glpi_plugin_rack_device_spec", "glpi_plugin_rack_profiles", "glpi_plugin_racks_profiles", "glpi_plugin_rack_config", "glpi_dropdown_plugin_rack_room_locations", "glpi_dropdown_plugin_rack_ways", "glpi_plugin_rack_others", "glpi_dropdown_plugin_rack_others_type"); foreach ($tables as $table) { $migration->dropTable($table); } $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_items_tickets", "glpi_dropdowntranslations"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` LIKE 'PluginRacks%';"); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginRacksProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginRacksProfile::removeRightsFromSession(); PluginRacksProfile::removeRightsFromDB(); PluginRacksMenu::removeRightsFromSession(); return true; }
function plugin_manufacturersimports_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/manufacturersimports/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/manufacturersimports/inc/menu.class.php"; $migration = new Migration("1.7.0"); $tables = array("glpi_plugin_manufacturersimports_configs", "glpi_plugin_manufacturersimports_models", "glpi_plugin_manufacturersimports_logs"); foreach ($tables as $table) { $migration->dropTable($table); } //old versions $tables = array("glpi_plugin_suppliertag_config", "glpi_plugin_suppliertag_profiles", "glpi_plugin_suppliertag_models", "glpi_plugin_suppliertag_imported"); foreach ($tables as $table) { $migration->dropTable($table); } $profileRight = new ProfileRight(); foreach (PluginManufacturersimportsProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } //Remove rigth from $_SESSION['glpiactiveprofile'] if exists PluginManufacturersimportsProfile::removeRightsFromSession(); //Remove entries in GLPI's menu and breadcrumb PluginManufacturersimportsMenu::removeRightsFromSession(); return true; }
function plugin_webapplications_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/webapplications/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/webapplications/inc/menu.class.php"; $tables = array("glpi_plugin_webapplications_webapplications", "glpi_plugin_webapplications_webapplicationtypes", "glpi_plugin_webapplications_webapplicationservertypes", "glpi_plugin_webapplications_webapplicationtechnics", "glpi_plugin_webapplications_webapplications_items"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } //old versions $tables = array("glpi_plugin_appweb", "glpi_dropdown_plugin_appweb_type", "glpi_dropdown_plugin_appweb_server_type", "glpi_dropdown_plugin_appweb_technic", "glpi_plugin_appweb_device", "glpi_plugin_appweb_profiles", "glpi_plugin_webapplications_profiles"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_notepads"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE\n FROM `{$table_glpi}`\n WHERE `itemtype` = 'PluginWebapplicationsWebapplication'"); } if (class_exists('PluginDatainjectionModel')) { PluginDatainjectionModel::clean(array('itemtype' => 'PluginWebapplicationsWebapplication')); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginWebapplicationsProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginWebapplicationsMenu::removeRightsFromSession(); PluginWebapplicationsProfile::removeRightsFromSession(); return true; }
@since 2009 -------------------------------------------------------------------------- */ include_once "../../../inc/includes.php"; Session::checkRight('profile', READ); Plugin::load('reports', true); Html::header(__('Reports plugin configuration', 'reports'), $_SERVER['PHP_SELF'], 'config', 'plugins'); require_once "../inc/profile.class.php"; $report = ''; if (isset($_POST['report'])) { $report = $_POST['report']; } $prof = new PluginReportsProfile(); if (isset($_POST['delete']) && $report) { $profile_right = new ProfileRight(); $profile_right->deleteByCriteria(array('name' => "plugin_reports_{$report}")); ProfileRight::addProfileRights(array("plugin_reports_{$report}")); } else { if (isset($_POST['update']) && $report) { Session::checkRight('profile', UPDATE); PluginReportsProfile::updateForReport($_POST); } } $tab = $prof->updatePluginRights(); echo "<form method='post' action=\"" . $_SERVER["PHP_SELF"] . "\">"; echo "<table class='tab_cadre'><tr><th colspan='2'>"; echo "<a href='config.form.php'>" . __('Reports plugin configuration', 'reports') . "</a><br> <br>"; echo __('Rights management by report', 'reports') . "</th></tr>\n"; echo "<tr class='tab_bg_1'><td>" . __('Report', 'Reports', 1) . " "; $query = "SELECT `id`, `name`\n FROM `glpi_profiles`\n ORDER BY `name`"; $result = $DB->query($query);
function plugin_racks_uninstall() { include_once GLPI_ROOT . "/plugins/racks/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/racks/inc/menu.class.php"; $migration = new Migration("1.5.0"); $tables = array("glpi_plugin_racks_racks", "glpi_plugin_racks_racks_items", "glpi_plugin_racks_itemspecifications", "glpi_plugin_racks_rackmodels", "glpi_plugin_racks_roomlocations", "glpi_plugin_racks_connections", "glpi_plugin_racks_configs", "glpi_plugin_racks_others", "glpi_plugin_racks_othermodels", "glpi_plugin_racks_racktypes", "glpi_plugin_racks_rackstates"); foreach ($tables as $table) { $migration->dropTable($table); } //old versions $tables = array("glpi_plugin_rack", "glpi_plugin_rack_content", "glpi_plugin_rack_device_spec", "glpi_plugin_rack_profiles", "glpi_plugin_racks_profiles", "glpi_plugin_rack_config", "glpi_dropdown_plugin_rack_room_locations", "glpi_dropdown_plugin_rack_ways", "glpi_plugin_rack_others", "glpi_dropdown_plugin_rack_others_type"); foreach ($tables as $table) { $migration->dropTable($table); } $itemtypes = array("DisplayPreference", "Document_Item", "Bookmark", "Log", "Ticket"); foreach ($itemtypes as $itemtype) { $item = new $itemtype(); $item->deleteByCriteria(array('itemtype' => 'PluginRacksRack')); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginRacksProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginRacksProfile::removeRightsFromSession(); PluginRacksProfile::removeRightsFromDB(); PluginRacksMenu::removeRightsFromSession(); return true; }
function plugin_accounts_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/accounts/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/accounts/inc/menu.class.php"; $tables = array("glpi_plugin_accounts_accounts", "glpi_plugin_accounts_accounts_items", "glpi_plugin_accounts_accounttypes", "glpi_plugin_accounts_accountstates", "glpi_plugin_accounts_configs", "glpi_plugin_accounts_hashs", "glpi_plugin_accounts_hashes", "glpi_plugin_accounts_aeskeys", "glpi_plugin_accounts_notificationstates"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } //old versions $tables = array("glpi_plugin_comptes", "glpi_plugin_compte_device", "glpi_dropdown_plugin_compte_type", "glpi_dropdown_plugin_compte_status", "glpi_plugin_compte_profiles", "glpi_plugin_compte_config", "glpi_plugin_compte_default", "glpi_plugin_compte_mailing", "glpi_plugin_compte", "glpi_plugin_compte_hash", "glpi_plugin_compte_aeskey", "glpi_plugin_accounts_profiles"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $notif = new Notification(); $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'new', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'ExpiredAccounts', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginAccountsAccount', 'event' => 'AccountsWhichExpire', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } //templates $template = new NotificationTemplate(); $translation = new NotificationTemplateTranslation(); $options = array('itemtype' => 'PluginAccountsAccount', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplates', $options) as $data) { $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) { $translation->delete($data_template); } $template->delete($data); } $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_items_tickets", "glpi_dropdowntranslations"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE FROM `{$table_glpi}`\n WHERE `itemtype` = 'PluginAccountsAccount'\n OR `itemtype` = 'PluginAccountsHelpdesk'\n OR `itemtype` = 'PluginAccountsGroup'\n OR `itemtype` = 'PluginAccountsAccountState'\n OR `itemtype` = 'PluginAccountsAccountType' ;"); } if (class_exists('PluginDatainjectionModel')) { PluginDatainjectionModel::clean(array('itemtype' => 'PluginAccountsAccount')); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginAccountsProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginAccountsProfile::removeRightsFromSession(); PluginAccountsMenu::removeRightsFromSession(); return true; }
function plugin_certificates_uninstall() { global $DB; include_once (GLPI_ROOT."/plugins/certificates/inc/profile.class.php"); include_once (GLPI_ROOT."/plugins/certificates/inc/menu.class.php"); $tables = array("glpi_plugin_certificates_certificates", "glpi_plugin_certificates_certificates_items", "glpi_plugin_certificates_certificatetypes", "glpi_plugin_certificates_certificatestates", "glpi_plugin_certificates_configs", "glpi_plugin_certificates_notificationstates"); foreach($tables as $table) $DB->query("DROP TABLE IF EXISTS `$table`;"); //old versions $tables = array("glpi_plugin_certificates", "glpi_plugin_certificates_profiles", "glpi_plugin_certificates_device", "glpi_dropdown_plugin_certificates_type", "glpi_dropdown_plugin_certificates_status", "glpi_plugin_certificates_config", "glpi_plugin_certificates_mailing", "glpi_plugin_certificates_default"); foreach($tables as $table) $DB->query("DROP TABLE IF EXISTS `$table`;"); $notif = new Notification(); $options = array('itemtype' => 'PluginCertificatesCertificate', 'event' => 'ExpiredCertificates', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginCertificatesCertificate', 'event' => 'CertificatesWhichExpire', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } //templates $template = new NotificationTemplate(); $translation = new NotificationTemplateTranslation(); $options = array('itemtype' => 'PluginCertificatesCertificate', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplates', $options) as $data) { $options_template = array('notificationtemplates_id' => $data['id'], 'FIELDS' => 'id'); foreach ($DB->request('glpi_notificationtemplatetranslations', $options_template) as $data_template) { $translation->delete($data_template); } $template->delete($data); } $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets", "glpi_contracts_items", "glpi_notepads"); foreach($tables_glpi as $table_glpi) $DB->query("DELETE FROM `$table_glpi` WHERE `itemtype` = 'PluginCertificatesCertificate';"); //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginCertificatesProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginCertificatesMenu::removeRightsFromSession(); PluginCertificatesProfile::removeRightsFromSession(); return true; }
/** * @return bool */ function plugin_ocsinventoryng_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/ocsinventoryng/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/ocsinventoryng/inc/menu.class.php"; $tables = array("glpi_plugin_ocsinventoryng_ocsservers", "glpi_plugin_ocsinventoryng_ocslinks", "glpi_plugin_ocsinventoryng_ocsadmininfoslinks", "glpi_plugin_ocsinventoryng_profiles", "glpi_plugin_ocsinventoryng_threads", "glpi_plugin_ocsinventoryng_snmpocslinks", "glpi_plugin_ocsinventoryng_ipdiscoverocslinks", "glpi_plugin_ocsinventoryng_servers", "glpi_plugin_ocsinventoryng_configs", "glpi_plugin_ocsinventoryng_notimportedcomputers", "glpi_plugin_ocsinventoryng_details", "glpi_plugin_ocsinventoryng_registrykeys", "glpi_plugin_ocsinventoryng_networkports", "glpi_plugin_ocsinventoryng_networkporttypes", "glpi_plugin_ocsinventoryng_ocsservers_profiles", "glpi_plugin_ocsinventoryng_devicebiosdatas", "glpi_plugin_ocsinventoryng_items_devicebiosdatas"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $tables_glpi = array("glpi_bookmarks", "glpi_displaypreferences", "glpi_logs"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE\r\n FROM `" . $table_glpi . "`\r\n WHERE `itemtype` IN ('PluginMassocsimportNotimported',\r\n 'PluginMassocsimportDetail',\r\n 'PluginOcsinventoryngOcsServer',\r\n 'PluginOcsinventoryngNotimportedcomputer',\r\n 'PluginOcsinventoryngDetail')"); } $tables_ocs = array("ocs_glpi_crontasks", "ocs_glpi_displaypreferences", "ocs_glpi_ocsadmininfoslinks", "ocs_glpi_ocslinks", "ocs_glpi_ocsservers", "ocs_glpi_registrykeys", "ocs_glpi_profiles"); foreach ($tables_ocs as $table_ocs) { $DB->query("DROP TABLE IF EXISTS `{$table_ocs}`;"); } $tables_mass = array("backup_glpi_plugin_massocsimport_configs", "backup_glpi_plugin_massocsimport_details", "backup_glpi_plugin_massocsimport_notimported", "backup_glpi_plugin_massocsimport_servers", "backup_glpi_plugin_massocsimport_threads"); foreach ($tables_mass as $table_mass) { $DB->query("DROP TABLE IF EXISTS `{$table_mass}`;"); } $query = "DELETE\r\n FROM `glpi_alerts`\r\n WHERE `itemtype` IN ('PluginMassocsimportNotimported',\r\n 'PluginOcsinventoryngNotimportedcomputer')"; $DB->queryOrDie($query, $DB->error()); // clean rules $rule = new RuleImportEntity(); foreach ($DB->request("glpi_rules", array('sub_type' => 'RuleImportEntity')) as $data) { $rule->delete($data); } $rule = new RuleImportComputer(); foreach ($DB->request("glpi_rules", array('sub_type' => 'RuleImportComputer')) as $data) { $rule->delete($data); } $notification = new Notification(); foreach (getAllDatasFromTable($notification->getTable(), "`itemtype` IN ('PluginMassocsimportNotimported',\r\n 'PluginOcsinventoryngNotimportedcomputer')") as $data) { $notification->delete($data); } $template = new NotificationTemplate(); foreach (getAllDatasFromTable($template->getTable(), "`itemtype` IN ('PluginMassocsimportNotimported',\r\n 'PluginOcsinventoryngNotimportedcomputer')") as $data) { $template->delete($data); } $cron = new CronTask(); if ($cron->getFromDBbyName('PluginMassocsimportThread', 'CleanOldThreads')) { CronTask::Unregister('massocsimport'); CronTask::Unregister('CleanOldThreads'); } if ($cron->getFromDBbyName('PluginOcsinventoryngOcsServer', 'ocsng')) { CronTask::Unregister('ocsinventoryng'); CronTask::Unregister('ocsng'); } if ($cron->getFromDBbyName('PluginOcsinventoryngNotimportedcomputer', 'SendAlerts')) { CronTask::Unregister('SendAlerts'); } if ($cron->getFromDBbyName('PluginOcsinventoryngOcsServer', 'CleanOldAgents')) { CronTask::Unregister('CleanOldAgents'); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginOcsinventoryngProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginOcsinventoryngMenu::removeRightsFromSession(); PluginOcsinventoryngProfile::removeRightsFromSession(); return true; }
function plugin_databases_uninstall() { global $DB; include_once GLPI_ROOT . "/plugins/databases/inc/profile.class.php"; include_once GLPI_ROOT . "/plugins/databases/inc/menu.class.php"; $tables = array("glpi_plugin_databases_databases", "glpi_plugin_databases_databasetypes", "glpi_plugin_databases_databasecategories", "glpi_plugin_databases_servertypes", "glpi_plugin_databases_scripttypes", "glpi_plugin_databases_instances", "glpi_plugin_databases_scripts", "glpi_plugin_databases_databases_items"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } //old versions $tables = array("glpi_plugin_sgbd", "glpi_dropdown_plugin_sgbd_type", "glpi_dropdown_plugin_sgbd_server_type", "glpi_plugin_sgbd_device", "glpi_plugin_sgbd_profiles", "glpi_dropdown_plugin_sgbd_script_type", "glpi_plugin_sgbd_instances", "glpi_plugin_sgbd_scripts", "glpi_dropdown_plugin_sgbd_category", "glpi_plugin_databases_profiles"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_items_tickets", "glpi_notepads"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` = 'PluginDatabasesDatabase' ;"); } if (class_exists('PluginDatainjectionModel')) { PluginDatainjectionModel::clean(array('itemtype' => 'PluginDatabasesDatabase')); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginDatabasesProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginDatabasesMenu::removeRightsFromSession(); PluginDatabasesProfile::removeRightsFromSession(); return true; }
function plugin_positions_uninstall() { global $DB; $tables = array("glpi_plugin_positions_positions", "glpi_plugin_positions_positions_items", "glpi_plugin_positions_imageitems", "glpi_plugin_positions_infos", "glpi_plugin_positions_configs"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $rep_files_positions = GLPI_PLUGIN_DOC_DIR . "/positions"; Toolbox::deleteDir($rep_files_positions); $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` = 'PluginPositionsPosition' ;"); } //Delete rights associated with the plugin $profileRight = new ProfileRight(); foreach (PluginPositionsProfile::getAllRights() as $right) { $profileRight->deleteByCriteria(array('name' => $right['field'])); } PluginPositionsMenu::removeRightsFromSession(); PluginPositionsProfile::removeRightsFromSession(); return true; }