Esempio n. 1
0
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_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;
}