function plugin_positions_uninstall() { global $DB; $tables = array("glpi_plugin_positions_positions", "glpi_plugin_positions_positions_items", "glpi_plugin_positions_profiles", "glpi_plugin_positions_imageitems", "glpi_plugin_positions_infos"); 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' ;"); } return true; }
function plugin_archires_uninstall() { global $DB; $tables = array("glpi_plugin_archires_imageitems", "glpi_plugin_archires_views", "glpi_plugin_archires_networkinterfacecolors", "glpi_plugin_archires_vlancolors", "glpi_plugin_archires_statecolors", "glpi_plugin_archires_profiles", "glpi_plugin_archires_locationqueries", "glpi_plugin_archires_networkequipmentqueries", "glpi_plugin_archires_appliancequeries", "glpi_plugin_archires_querytypes"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } //old versions $tables = array("glpi_plugin_archires_query_location", "glpi_plugin_archires_query_switch", "glpi_plugin_archires_query_applicatifs", "glpi_plugin_archires_image_device", "glpi_plugin_archires_query_type", "glpi_plugin_archires_color_iface", "glpi_plugin_archires_color_state", "glpi_plugin_archires_config", "glpi_plugin_archires_color_vlan"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $rep_files_archires = GLPI_PLUGIN_DOC_DIR . "/archires"; Toolbox::deleteDir($rep_files_archires); $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE FROM `{$table_glpi}`\n WHERE `itemtype` = 'PluginArchiresLocationQuery'\n OR `itemtype` = 'PluginArchiresNetworkEquipmentQuery'\n OR `itemtype` = 'PluginArchiresApplianceQuery'\n OR `itemtype` = 'PluginArchiresView';"); } return true; }
static function uninstall() { global $DB; if (is_dir(PLUGIN_THEMES_UPLOAD_DIR)) { Toolbox::deleteDir(PLUGIN_THEMES_UPLOAD_DIR); } if (TableExists("glpi_plugin_themes_themes")) { $result = $DB->query("DROP TABLE IF EXISTS `glpi_plugin_themes_themes`;"); } else { $result = true; } if (TableExists("glpi_plugin_themes_per_user")) { $result = $DB->query("DROP TABLE IF EXISTS `glpi_plugin_themes_per_user`;"); } else { $result = true; } if (!$result) { return array('success' => false, 'msg' => 'Uninstallation Error'); } else { return array('success' => true); } }
function plugin_custom_uninstall() { global $DB; //Delete plugin's table $tables = array('glpi_plugin_custom_tabs', 'glpi_plugin_custom_defaulttabs', 'glpi_plugin_custom_styles', 'glpi_plugin_custom_profiles', 'glpi_plugin_custom_tabprofiles'); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`"); } //delete plugin files dir Toolbox::deleteDir(CUSTOM_FILES_DIR); return true; }
function plugin_projet_uninstall() { global $DB; $tables = array("glpi_plugin_projet_projets", "glpi_plugin_projet_projetstates", "glpi_plugin_projet_projets_items", "glpi_plugin_projet_projets_projets", "glpi_plugin_projet_tasks", "glpi_plugin_projet_tasks_items", "glpi_plugin_projet_taskstates", "glpi_plugin_projet_tasktypes", "glpi_plugin_projet_taskplannings", "glpi_plugin_projet_tasks_tasks", "glpi_plugin_projet_profiles", "glpi_plugin_projet_followups"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $oldtables = array("glpi_plugin_projet", "glpi_plugin_projet_items", "glpi_plugin_projet_tasks", "glpi_plugin_projet_tasks_items", "glpi_dropdown_plugin_projet_tasks_type", "glpi_plugin_projet_mailing", "glpi_dropdown_plugin_projet_status", "glpi_dropdown_plugin_projet_task_status", "glpi_plugin_project", "glpi_plugin_project_items", "glpi_plugin_project_tasks", "glpi_plugin_project_tasks_items", "glpi_dropdown_plugin_project_status", "glpi_dropdown_plugin_project_tasks_type", "glpi_dropdown_plugin_project_task_status", "glpi_plugin_project_mailing", "glpi_plugin_project_profiles", "glpi_plugin_project_users", "glpi_plugin_project_setup", "glpi_plugin_project_groups", "glpi_plugin_project_items", "glpi_plugin_project_enterprises", "glpi_plugin_project_contracts", "glpi_plugin_project_documents", "glpi_dropdown_project_tasks_type", "glpi_project", "glpi_project_tasks", "glpi_project_user", "glpi_project_items", "glpi_plugin_projet_projetitems", "glpi_plugin_projet_mailings", "glpi_plugin_projet_taskitems"); foreach ($oldtables as $oldtable) { $DB->query("DROP TABLE IF EXISTS `{$oldtable}`;"); } $rep_files_projet = GLPI_PLUGIN_DOC_DIR . "/projet"; Toolbox::deleteDir($rep_files_projet); $in = "IN (" . implode(',', array("'PluginProjetProjet'", "'PluginProjetTask'")) . ")"; $tables = array("glpi_displaypreferences", "glpi_documents_items", "glpi_contracts_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets"); foreach ($tables as $table) { $query = "DELETE FROM `{$table}` WHERE (`itemtype` " . $in . " ) "; $DB->query($query); } $notif = new Notification(); $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'new', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'update', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'delete', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'newtask', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'updatetask', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginProjetProjet', 'event' => 'deletetask', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } //templates $template = new NotificationTemplate(); $translation = new NotificationTemplateTranslation(); $options = array('itemtype' => 'PluginProjetProjet', '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); } return true; }
$t->getFromDB($_GET['activate']); PluginThemesTheme::resetActiveTheme(); $values = array('id' => $_GET['activate'], 'active_theme' => '1'); $t->update($values); header('location:' . $CFG_GLPI['root_doc'] . '/plugins/themes/front/themes.php'); } if (isset($_GET['delete']) && PluginThemesTheme::canCreate()) { if (!$t->getFromDB($_GET['delete'])) { global $CFG_GLPI; Session::addMessageAfterRedirect(__('Error while deleting', 'themes'), false, ERROR); header('location:' . $CFG_GLPI['root_doc'] . '/plugins/themes/front/themes.php'); } if ($t->fields['active_theme'] == "1") { $DB->query("UPDATE glpi_plugin_themes_themes SET active_theme = 1 WHERE name = 'GLPI'"); } if (is_dir(PLUGIN_THEMES_UPLOAD_DIR . "/" . $t->fields['name'])) { Toolbox::deleteDir(PLUGIN_THEMES_UPLOAD_DIR . "/" . $t->fields['name']); } $DB->query("DELETE FROM glpi_plugin_themes_per_user WHERE theme_id = {$t->fields['id']};"); $DB->query("DELETE FROM glpi_plugin_themes_themes WHERE id = {$_GET['delete']};"); Session::addMessageAfterRedirect(__('Theme deleted', 'themes'), false, INFO); header('location:' . $CFG_GLPI['root_doc'] . '/plugins/themes/front/themes.php'); } $plugin = new Plugin(); Html::header(__('Themes manager', 'themes'), '', "plugins", "themes"); if (plugin_themes_haveRight('themes', 'r')) { PluginThemesTheme::showAllThemes(); } else { Html::displayRightError(); } Html::footer();
function plugin_datainjection_uninstall() { global $DB; $tables = array("glpi_plugin_datainjection_models", "glpi_plugin_datainjection_modelcsvs", "glpi_plugin_datainjection_mappings", "glpi_plugin_datainjection_infos", "glpi_plugin_datainjection_filetype", "glpi_plugin_datainjection_profiles"); foreach ($tables as $table) { if (TableExists($table)) { $DB->queryOrDie("DROP TABLE IF EXISTS `" . $table . "`", $DB->error()); } } if (is_dir(PLUGIN_DATAINJECTION_UPLOAD_DIR)) { Toolbox::deleteDir(PLUGIN_DATAINJECTION_UPLOAD_DIR); } plugin_init_datainjection(); return true; }
function plugin_resources_uninstall() { global $DB; $tables = array("glpi_plugin_resources_resources", "glpi_plugin_resources_resources_items", "glpi_plugin_resources_employees", "glpi_plugin_resources_employers", "glpi_plugin_resources_clients", "glpi_plugin_resources_choices", "glpi_plugin_resources_choiceitems", "glpi_plugin_resources_departments", "glpi_plugin_resources_contracttypes", "glpi_plugin_resources_resourcestates", "glpi_plugin_resources_tasktypes", "glpi_plugin_resources_profiles", "glpi_plugin_resources_tasks", "glpi_plugin_resources_taskplannings", "glpi_plugin_resources_tasks_items", "glpi_plugin_resources_checklists", "glpi_plugin_resources_checklistconfigs", "glpi_plugin_resources_reportconfigs", "glpi_plugin_resources_resourcerestings", "glpi_plugin_resources_resourceholidays", "glpi_plugin_resources_ticketcategories", "glpi_plugin_resources_resourcesituations", "glpi_plugin_resources_contractnatures", "glpi_plugin_resources_ranks", "glpi_plugin_resources_resourcespecialities", "glpi_plugin_resources_leavingreasons", "glpi_plugin_resources_professions", "glpi_plugin_resources_professionlines", "glpi_plugin_resources_professioncategories", "glpi_plugin_resources_employments", "glpi_plugin_resources_employmentstates", "glpi_plugin_resources_budgets", "glpi_plugin_resources_costs", "glpi_plugin_resources_budgettypes", "glpi_plugin_resources_budgetvolumes"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } //old versions $tables = array("glpi_plugin_resources", "glpi_plugin_resources_device", "glpi_plugin_resources_needs", "glpi_plugin_resources_employee", "glpi_dropdown_plugin_resources_employer", "glpi_dropdown_plugin_resources_client", "glpi_dropdown_plugin_resources_type", "glpi_dropdown_plugin_resources_department", "glpi_dropdown_plugin_resources_tasks_type", "glpi_plugin_resources_mailingsettings", "glpi_plugin_resources_mailing"); foreach ($tables as $table) { $DB->query("DROP TABLE IF EXISTS `{$table}`;"); } $in = "IN (" . implode(',', array("'PluginResourcesResource'", "'PluginResourcesTask'", "'PluginResourcesHelpdesk'", "'PluginResourcesDirectory'", "'PluginResourcesChecklistconfig'", "'PluginResourcesResourceResting'", "'PluginResourcesResourceHoliday'", "'PluginResourcesBudget'", "'PluginResourcesEmployment'", "'PluginResourcesRecap'")) . ")"; $tables = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets"); foreach ($tables as $table) { $query = "DELETE FROM `{$table}` WHERE (`itemtype` " . $in . " ) "; $DB->query($query); } //drop rules $Rule = new Rule(); $a_rules = $Rule->find("`sub_type`='PluginResourcesRuleChecklist'\n OR `sub_type`='PluginResourcesRuleContracttype'"); foreach ($a_rules as $data) { $Rule->delete($data); } $notif = new Notification(); $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'new', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'update', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'delete', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newtask', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updatetask', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deletetask', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertExpiredTasks', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertLeavingResources', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertArrivalChecklists', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertLeavingChecklists', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'LeavingResource', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'report', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newresting', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updateresting', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deleteresting', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newholiday', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updateholiday', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deleteholiday', 'FIELDS' => 'id'); foreach ($DB->request('glpi_notifications', $options) as $data) { $notif->delete($data); } //templates $template = new NotificationTemplate(); $translation = new NotificationTemplateTranslation(); $options = array('itemtype' => 'PluginResourcesResource', '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); } if (class_exists('PluginDatainjectionModel')) { PluginDatainjectionModel::clean(array('itemtype' => 'PluginResourcesResource')); PluginDatainjectionModel::clean(array('itemtype' => 'PluginResourcesClient')); } $rep_files_resources = GLPI_PLUGIN_DOC_DIR . "/resources"; Toolbox::deleteDir($rep_files_resources); 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; }
function plugin_mreporting_uninstall() { global $DB; $queries = array("DROP TABLE IF EXISTS glpi_plugin_mreporting_profiles", "DROP TABLE IF EXISTS glpi_plugin_mreporting_configs", "DROP TABLE IF EXISTS glpi_plugin_mreporting_preferences", "DROP TABLE IF EXISTS glpi_plugin_mreporting_notifications"); foreach ($queries as $query) { $DB->query($query); } $rep_files_mreporting = GLPI_PLUGIN_DOC_DIR . "/mreporting"; $notifications_folder = GLPI_PLUGIN_DOC_DIR . "/mreporting/notifications"; Toolbox::deleteDir($notifications_folder); Toolbox::deleteDir($rep_files_mreporting); $tables_glpi = array("glpi_displaypreferences", "glpi_bookmarks"); foreach ($tables_glpi as $table_glpi) { $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` = 'PluginMreportingConfig' ;"); } require_once "inc/notification.class.php"; PluginMreportingNotification::uninstall(); return true; }