function plugin_geninventorynumber_uninstall() { $migration = new Migration("0.85+1.0"); include_once GLPI_ROOT . '/plugins/geninventorynumber/inc/config.class.php'; include_once GLPI_ROOT . '/plugins/geninventorynumber/inc/profile.class.php'; include_once GLPI_ROOT . '/plugins/geninventorynumber/inc/configfield.class.php'; PluginGeninventorynumberConfig::uninstall($migration); PluginGeninventorynumberProfile::removeRightsFromSession(); PluginGeninventorynumberProfile::uninstallProfile(); PluginGeninventorynumberConfigField::uninstall($migration); return true; }
static function install(Migration $migration) { global $DB; $table = getTableForItemType(__CLASS__); if (isset($_SESSION['glpiactiveprofile'])) { PluginGeninventorynumberProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); } if (TableExists("glpi_plugin_geninventorynumber_profiles")) { foreach (getAllDatasFromTable($table) as $data) { $profile = new self(); foreach ($profile->getAllRights() as $right => $rights) { if (!countElementsInTable('glpi_profilerights', "`profiles_id`='" . $data['profiles_id'] . "' \n AND `name`='" . $rights['field'] . "'")) { $profileRight = new ProfileRight(); $myright = array(); $myright['name'] = $rights['field']; $myright['profiles_id'] = $data['profiles_id']; if (!strcmp($data['plugin_geninventorynumber_generate'], 'w')) { $myright['rights'] = CREATE; } if (!strcmp($data['plugin_geninventorynumber_overwrite'], 'w')) { $myright['rights'] += UPDATE; } $profileRight->add($myright); } } } $migration->dropTable($table); } }