Example #1
0
function updateDbUpTo031()
{
    global $DB, $migration;
    $ret = array();
    // Before 0.31
    if (!TableExists("glpi_config") && !TableExists("glpi_configs")) {
        $query = "CREATE TABLE `glpi_config` (\n                  `ID` int(11) NOT NULL auto_increment,\n                  `num_of_events` varchar(200) NOT NULL default '',\n                  `jobs_at_login` varchar(200) NOT NULL default '',\n                  `sendexpire` varchar(200) NOT NULL default '',\n                  `cut` varchar(200) NOT NULL default '',\n                  `expire_events` varchar(200) NOT NULL default '',\n                  `list_limit` varchar(200) NOT NULL default '',\n                  `version` varchar(200) NOT NULL default '',\n                  `logotxt` varchar(200) NOT NULL default '',\n                  `root_doc` varchar(200) NOT NULL default '',\n                  `event_loglevel` varchar(200) NOT NULL default '',\n                  `mailing` varchar(200) NOT NULL default '',\n                  `imap_auth_server` varchar(200) NOT NULL default '',\n                  `imap_host` varchar(200) NOT NULL default '',\n                  `ldap_host` varchar(200) NOT NULL default '',\n                  `ldap_basedn` varchar(200) NOT NULL default '',\n                  `ldap_rootdn` varchar(200) NOT NULL default '',\n                  `ldap_pass` varchar(200) NOT NULL default '',\n                  `admin_email` varchar(200) NOT NULL default '',\n                  `mailing_signature` varchar(200) NOT NULL default '',\n                  `mailing_new_admin` varchar(200) NOT NULL default '',\n                  `mailing_followup_admin` varchar(200) NOT NULL default '',\n                  `mailing_finish_admin` varchar(200) NOT NULL default '',\n                  `mailing_new_all_admin` varchar(200) NOT NULL default '',\n                  `mailing_followup_all_admin` varchar(200) NOT NULL default '',\n                  `mailing_finish_all_admin` varchar(200) NOT NULL default '',\n                  `mailing_new_all_normal` varchar(200) NOT NULL default '',\n                  `mailing_followup_all_normal` varchar(200) NOT NULL default '',\n                  `mailing_finish_all_normal` varchar(200) NOT NULL default '',\n                  `mailing_new_attrib` varchar(200) NOT NULL default '',\n                  `mailing_followup_attrib` varchar(200) NOT NULL default '',\n                  `mailing_finish_attrib` varchar(200) NOT NULL default '',\n                  `mailing_new_user` varchar(200) NOT NULL default '',\n                  `mailing_followup_user` varchar(200) NOT NULL default '',\n                  `mailing_finish_user` varchar(200) NOT NULL default '',\n                  `ldap_field_name` varchar(200) NOT NULL default '',\n                  `ldap_field_email` varchar(200) NOT NULL default '',\n                  `ldap_field_location` varchar(200) NOT NULL default '',\n                  `ldap_field_realname` varchar(200) NOT NULL default '',\n                  `ldap_field_phone` varchar(200) NOT NULL default '',\n                PRIMARY KEY (`ID`)\n                ) TYPE=MyISAM AUTO_INCREMENT=2 ";
        $DB->queryOrDie($query);
        $query = "INSERT INTO `glpi_config`\n                VALUES (1, '10', '1', '1', '80', '30', '15', ' 0.31', 'GLPI powered by indepnet',\n                        '/glpi', '5', '0', '', '', '', '', '', '', '*****@*****.**', 'SIGNATURE',\n                        '1', '1', '1', '1', '0', '0', '0', '0', '0', '0', '0', '0','1', '1', '1',\n                        'uid', 'mail', 'physicaldeliveryofficename', 'cn', 'telephonenumber')";
        $DB->queryOrDie($query);
        echo "<p class='center'>Version > 0.31  </p>";
    }
    // Save if problem with session during update
    $glpilanguage = $_SESSION["glpilanguage"];
    // < 0.78
    if (TableExists("glpi_config")) {
        // Get current version
        // Use language from session, even if sometime not reliable
        $query = "SELECT `version`, 'language'\n                FROM `glpi_config`";
        $result = $DB->queryOrDie($query, "get current version");
        $current_version = trim($DB->result($result, 0, 0));
        $glpilanguage = trim($DB->result($result, 0, 1));
        // < 0.85
    } else {
        if (FieldExists('glpi_configs', 'version')) {
            // Get current version and language
            $query = "SELECT `version`, `language`\n                FROM `glpi_configs`";
            $result = $DB->queryOrDie($query, "get current version");
            $current_version = trim($DB->result($result, 0, 0));
            $glpilanguage = trim($DB->result($result, 0, 1));
        } else {
            $configurationValues = Config::getConfigurationValues('core', array('version', 'language'));
            $current_version = $configurationValues['version'];
            $glpilanguage = $configurationValues['language'];
        }
    }
    // To prevent problem of execution time
    ini_set("max_execution_time", "0");
    $migration = new Migration($current_version);
    switch ($current_version) {
        case "0.31":
            include "update_031_04.php";
            update031to04();
        case "0.4":
        case "0.41":
            include "update_04_042.php";
            update04to042();
        case "0.42":
            showLocationUpdateForm();
            include "update_042_05.php";
            update042to05();
        case "0.5":
            include "update_05_051.php";
            update05to051();
        case "0.51":
        case "0.51a":
            include "update_051_06.php";
            update051to06();
        case "0.6":
            include "update_06_065.php";
            update06to065();
        case "0.65":
            include "update_065_068.php";
            update065to068();
        case "0.68":
            include "update_068_0681.php";
            update068to0681();
        case "0.68.1":
        case "0.68.2":
        case "0.68.3":
            // Force update content
            if (showLocationUpdateForm()) {
                $query = "UPDATE `glpi_config`\n                      SET `version` = ' 0.68.3x'";
                $DB->queryOrDie($query, "0.68.3");
                showContentUpdateForm();
                exit;
            }
        case "0.68.3x":
            // Special version for replay upgrade process from here
            include "update_0681_07.php";
            update0681to07();
        case "0.7":
        case "0.70.1":
        case "0.70.2":
            include "update_07_071.php";
            update07to071();
        case "0.71":
        case "0.71.1":
            include "update_071_0712.php";
            update071to0712();
        case "0.71.2":
            include "update_0712_0713.php";
            update0712to0713();
        case "0.71.3":
        case "0.71.4":
        case "0.71.5":
        case "0.71.6":
            include "update_0713_072.php";
            update0713to072();
        case "0.72":
            include "update_072_0721.php";
            update072to0721();
        case "0.72.1":
            include "update_0721_0722.php";
            update0721to0722();
        case "0.72.2":
        case "0.72.21":
            include "update_0722_0723.php";
            update0722to0723();
        case "0.72.3":
        case "0.72.4":
            include "update_0723_078.php";
            update0723to078();
        case "0.78":
            include "update_078_0781.php";
            update078to0781();
        case "0.78.1":
            include "update_0781_0782.php";
            update0781to0782();
        case "0.78.2":
        case "0.78.3":
        case "0.78.4":
        case "0.78.5":
            include "update_0782_080.php";
            update0782to080();
        case "0.80":
            include "update_080_0801.php";
            update080to0801();
        case "0.80.1":
        case "0.80.2":
            include "update_0801_0803.php";
            update0801to0803();
        case "0.80.3":
        case "0.80.4":
        case "0.80.5":
        case "0.80.6":
        case "0.80.61":
        case "0.80.7":
            include "update_0803_083.php";
            update0803to083();
        case "0.83":
            include "update_083_0831.php";
            update083to0831();
        case "0.83.1":
        case "0.83.2":
            include "update_0831_0833.php";
            update0831to0833();
        case "0.83.3":
        case "0.83.31":
        case "0.83.4":
        case "0.83.5":
        case "0.83.6":
        case "0.83.7":
        case "0.83.8":
        case "0.83.9":
        case "0.83.91":
            include "update_0831_084.php";
            update0831to084();
        case "0.84":
            include "update_084_0841.php";
            update084to0841();
        case "0.84.1":
        case "0.84.2":
            include "update_0841_0843.php";
            update0841to0843();
        case "0.84.3":
            include "update_0843_0844.php";
            update0843to0844();
        case "0.84.4":
        case "0.84.5":
            include "update_0845_0846.php";
            update0845to0846();
        case "0.84.6":
        case "0.84.7":
        case "0.84.8":
        case "0.84.9":
            include "update_084_085.php";
            update084to085();
        case "0.85":
        case "0.85.1":
        case "0.85.2":
            include "update_085_0853.php";
            update085to0853();
        case "0.85.3":
        case "0.85.4":
        case "0.85.5":
            include "update_0853_090.php";
            update0853to090();
        case "0.90":
            break;
        default:
            include "update_031_04.php";
            update031to04();
            include "update_04_042.php";
            update04to042();
            showLocationUpdateForm();
            include "update_042_05.php";
            update042to05();
            include "update_05_051.php";
            update05to051();
            include "update_051_06.php";
            update051to06();
            include "update_06_065.php";
            update06to065();
            include "update_065_068.php";
            update065to068();
            include "update_068_0681.php";
            update068to0681();
            // Force update content
            $query = "UPDATE `glpi_config`\n                   SET `version` = ' 0.68.3x'";
            $DB->queryOrDie($query, "0.68.3");
            showContentUpdateForm();
            exit;
    }
    // Update version number and default langage and new version_founded ---- LEAVE AT THE END
    Config::setConfigurationValues('core', array('version' => '0.90', 'language' => $glpilanguage, 'founded_new_version' => ''));
    // Update process desactivate all plugins
    $plugin = new Plugin();
    $plugin->unactivateAll();
    DBmysql::optimize_tables($migration);
    return $ret;
}
Example #2
0
     update0843to0844();
 case "0.84.4":
 case "0.84.5":
     include_once "../install/update_0845_0846.php";
     update0845to0846();
 case "0.84.6":
 case "0.84.7":
 case "0.84.8":
 case "0.84.9":
     include_once "../install/update_084_085.php";
     update084to085();
 case "0.85":
 case "0.85.1":
 case "0.85.2":
     include_once "../install/update_085_0853.php";
     update085to0853();
 case "0.85.3":
 case "0.85.4":
     include_once "../install/update_0853_0855.php";
     update0853to0855();
 case "0.85.5":
     include_once "../install/update_0855_090.php";
     update0855to090();
 case "0.90":
     include_once "../install/update_090_0901.php";
     update090to0901();
 case "0.90.1":
 case "0.90.2":
 case "0.90.3":
 case "0.90.4":
     include_once "../install/update_0901_0905.php";