function plugin_webapplications_install() { global $DB; include_once GLPI_ROOT . "/plugins/webapplications/inc/profile.class.php"; $update = false; if (!TableExists("glpi_application") && !TableExists("glpi_plugin_appweb") && !TableExists("glpi_plugin_webapplications_webapplications")) { $DB->runFile(GLPI_ROOT . "/plugins/webapplications/sql/empty-1.8.0.sql"); } else { if (TableExists("glpi_application") && !TableExists("glpi_plugin_appweb")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/webapplications/sql/update-1.1.sql"); } //from 1.1 version if (TableExists("glpi_plugin_appweb") && !FieldExists("glpi_plugin_appweb", "location")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/webapplications/sql/update-1.3.sql"); } //from 1.3 version if (TableExists("glpi_plugin_appweb") && !FieldExists("glpi_plugin_appweb", "recursive")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/webapplications/sql/update-1.4.sql"); } if (TableExists("glpi_plugin_appweb_profiles") && FieldExists("glpi_plugin_appweb_profiles", "interface")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/webapplications/sql/update-1.5.0.sql"); } if (TableExists("glpi_plugin_appweb") && !FieldExists("glpi_plugin_appweb", "helpdesk_visible")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/webapplications/sql/update-1.5.1.sql"); } if (!TableExists("glpi_plugin_webapplications_webapplications")) { $update = true; $DB->runFile(GLPI_ROOT . "/plugins/webapplications/sql/update-1.6.0.sql"); } //from 1.6 version if (TableExists("glpi_plugin_webapplications_webapplications") && !FieldExists("glpi_plugin_webapplications_webapplications", "users_id_tech")) { $DB->runFile(GLPI_ROOT . "/plugins/webapplications/sql/update-1.8.0.sql"); } } if ($update) { $query_ = "SELECT *\n FROM `glpi_plugin_webapplications_profiles` "; $result_ = $DB->query($query_); if ($DB->numrows($result_) > 0) { while ($data = $DB->fetch_array($result_)) { $query = "UPDATE `glpi_plugin_webapplications_profiles`\n SET `profiles_id` = '" . $data["id"] . "'\n WHERE `id` = '" . $data["id"] . "';"; $result = $DB->query($query); } } $query = "ALTER TABLE `glpi_plugin_webapplications_profiles`\n DROP `name` ;"; $result = $DB->query($query); Plugin::migrateItemType(array(1300 => 'PluginWebapplicationsWebapplication'), array("glpi_bookmarks", "glpi_bookmarks_users", "glpi_displaypreferences", "glpi_documents_items", "glpi_infocoms", "glpi_logs", "glpi_tickets"), array("glpi_plugin_webapplications_webapplications_items")); Plugin::migrateItemType(array(1200 => "PluginAppliancesAppliance"), array("glpi_plugin_webapplications_webapplications_items")); } PluginWebapplicationsProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); 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; }
Copyright (C) 2003-2011 by the Webapplications Development Team. https://forge.indepnet.net/projects/webapplications ------------------------------------------------------------------------- LICENSE This file is part of Webapplications. Webapplications is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Webapplications is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Webapplications. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ include '../../../inc/includes.php'; Session::checkRight("profile", "r"); $prof = new PluginWebapplicationsProfile(); //Save profile if (isset($_POST['update'])) { $prof->update($_POST); Html::back(); }