From: Scott P. <wht...@us...> - 2007-09-30 17:18:36
|
Update of /cvsroot/helpmeict/Helpdesk/system In directory sc8-pr-cvs17:/tmp/cvs-serv31307/system Modified Files: upgrade.1.0.inc.php upgrade.php Log Message: Update upgrade scripts for 1.0 Index: upgrade.1.0.inc.php =================================================================== RCS file: /cvsroot/helpmeict/Helpdesk/system/upgrade.1.0.inc.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** upgrade.1.0.inc.php 11 Mar 2007 15:23:49 -0000 1.3 --- upgrade.1.0.inc.php 30 Sep 2007 17:18:32 -0000 1.4 *************** *** 29,48 **** */ ! // Initialize array (important!) ! $qry = array(); ! // Add 'tbl_files' table ! $output[] = "Adding table 'tbl_Assets' ....... "; ! $qry['pgsql'] = " ! CREATE TABLE tbl_assets ( ! );"; ! $qry['mysql'] = " ! CREATE TABLE `tbl_Assets` ( ! );"; ! $qry['mssql'] = ""; ! if ($qry[$helpdeskdb->phptype] != "") ! { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; ! } else $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ?> --- 29,193 ---- */ ! // Initialize array (important!) ! $qry = array(); ! // Add 'ldap' column to table tbl_users ! $output[] = "Adding ldap column to table 'tbl_users' ....... "; ! $qry['pgsql'] = "ALTER TABLE tbl_users ADD COLUMN ldap smallint"; ! $qry['mysql'] = "ALTER TABLE tbl_users ADD COLUMN smallint DEFAULT '0' NOT NULL"; ! $qry['mssql'] = "ALTER TABLE tbl_users ADD COLUMN smallint"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ! ! // Set default value for new 'ldap' column in tbl_users ! $output[] = "Setting default value for 'ldap' column in tbl_users ....... "; ! $qry = "UPDATE tbl_users SET ldap='0'"; ! $res = $helpdeskdb->query($qry); ! if (!PEAR::isError($res)) { ! //PostgreSQL and MSSQL need a couple of more ALTER TABLE's ! if ($helpdeskdb->phptype == 'pgsql' || $helpdesk->phptype =='mssql') { ! $qry = "ALTER TABLE tbl_users ALTER COLUMN ldap SET DEFAULT '0'"; ! $res = $helpdeskdb->query($qry); ! if (!PEAR::isError($res)) { ! // Set column to not allow NULL ! $qry = "ALTER TABLE tbl_users ALTER COLUMN ldap SET NOT NULL"; ! $res = $helpdeskdb->query($qry); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = $res->getMessage(); //Query failed ! } ! } ! else { ! $output [] = "Success!<br />\n"; ! } ! } ! else { ! $output[] = $res->getMessage(); //Query failed ! } ! ! // Re-initialize arry (important!) ! $qry = array(); ! //Insert ldap-ause prefs to tbl_preference_descriptions ! $output[] = "Adding ldap-ause preference to tbl_preference_descriptions ....... "; ! $qry['pgsql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-ause', 'boolean', 'Use LDAP Authentication', '0')"; ! $qry['mysql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-ause', 'boolean', 'Use LDAP Authentication', '0')"; ! $qry['mssql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-ause', 'boolean', 'Use LDAP Authentication', '0')"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ! ! // Re-initialize arry (important!) ! $qry = array(); ! //Insert ldap-basdn prefs to tbl_preference_descriptions ! $output[] = "Adding ldap-basdn preference to tbl_preference_descriptions ....... "; ! $qry['pgsql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-basedn', 'text', 'LDAP BaseDN', '0')"; ! $qry['mysql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-basedn', 'text', 'LDAP BaseDN', '0')"; ! $qry['mssql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-basedn', 'text', 'LDAP BaseDN', '0')"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ! ! // Re-initialize arry (important!) ! $qry = array(); ! //Insert ldap-host prefs to tbl_preference_descriptions ! $output[] = "Adding ldap-host preference to tbl_preference_descriptions ....... "; ! $qry['pgsql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-host', 'text', 'LDAP Hostname', '0')"; ! $qry['mysql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-host', 'text', 'LDAP Hostname', '0')"; ! $qry['mssql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-host', 'text', 'LDAP Hostname', '0')"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ! ! // Re-initialize arry (important!) ! $qry = array(); ! //Insert ldap-v2 prefs to tbl_preference_descriptions ! $output[] = "Adding ldap-v2 preference to tbl_preference_descriptions ....... "; ! $qry['pgsql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-v2', 'boolean', 'Use LDAP Protocol Version 2(No means Version 3)', '0')"; ! $qry['mysql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-v2', 'boolean', 'Use LDAP Protocol Version 2(No means Version 3)', '0')"; ! $qry['mssql'] = "INSERT INTO tbl_preference_descriptions (identifier, type, description, overridable) VALUES ('ldap-v2', 'boolean', 'Use LDAP Protocol Version 2(No means Version 3)', '0')"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ! ! // Re-initialize arry (important!) ! $qry = array(); ! //Insert ldap-ause pref to tbl_default_preferences ! $output[] = "Adding ldap-ause preference to tbl_default_preferences ....... "; ! $qry['pgsql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-ause', 'false')"; ! $qry['mysql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-ause', 'false')"; ! $qry['mssql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-ause', 'false')"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ! ! // Re-initialize arry (important!) ! $qry = array(); ! //Insert ldap-basedn pref to tbl_default_preferences ! $output[] = "Adding ldap-basedn preference to tbl_default_preferences ....... "; ! $qry['pgsql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-basedn', '')"; ! $qry['mysql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-basedn', '')"; ! $qry['mssql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-basedn', '')"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ! ! // Re-initialize arry (important!) ! $qry = array(); ! //Insert ldap-host pref to tbl_default_preferences ! $output[] = "Adding ldap-host preference to tbl_default_preferences ....... "; ! $qry['pgsql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-host', '')"; ! $qry['mysql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-host', '')"; ! $qry['mssql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-host', '')"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ! ! // Re-initialize arry (important!) ! $qry = array(); ! //Insert ldap-v2 pref to tbl_default_preferences ! $output[] = "Adding ldap-v2 preference to tbl_default_preferences ....... "; ! $qry['pgsql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-v2', 'false')"; ! $qry['mysql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-v2', 'false')"; ! $qry['mssql'] = "INSERT INTO tbl_default_preferences (identifier, value) VALUES ('ldap-v2', 'false')"; ! if ($qry[$helpdeskdb->phptype] != "") { ! $res = $helpdeskdb->query($qry[$helpdeskdb->phptype]); ! $output[] = (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<br />\n"; ! } ! else { ! $output[] = "ERROR: DBMS " . $helpdeskdb->phptype . " not yet supported by the upgrade routine!<BR />\n"; ! } ?> Index: upgrade.php =================================================================== RCS file: /cvsroot/helpmeict/Helpdesk/system/upgrade.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** upgrade.php 11 Mar 2007 15:23:49 -0000 1.3 --- upgrade.php 30 Sep 2007 17:18:32 -0000 1.4 *************** *** 87,91 **** include 'system/upgrade.0.9.3.inc.php'; include 'system/upgrade.0.9.9.inc.php'; ! // include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; --- 87,91 ---- include 'system/upgrade.0.9.3.inc.php'; include 'system/upgrade.0.9.9.inc.php'; ! include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; *************** *** 105,109 **** include 'system/upgrade.0.9.3.inc.php'; include 'system/upgrade.0.9.9.inc.php'; ! // include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; --- 105,110 ---- include 'system/upgrade.0.9.3.inc.php'; include 'system/upgrade.0.9.9.inc.php'; ! include 'system/upgrade.1.0.inc.php'; ! $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; *************** *** 122,126 **** include 'system/upgrade.0.9.3.inc.php'; include 'system/upgrade.0.9.9.inc.php'; ! // include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; --- 123,127 ---- include 'system/upgrade.0.9.3.inc.php'; include 'system/upgrade.0.9.9.inc.php'; ! include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; *************** *** 138,142 **** include 'system/upgrade.0.9.9.inc.php'; ! // include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; --- 139,143 ---- include 'system/upgrade.0.9.9.inc.php'; ! include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; *************** *** 146,150 **** case '0.9.9': ! // From development version v0.9.9 $output[] = "<div class=\"maindark\"> <p>Upgrade from v" . $global_prefs['version'] . " to " . SCRIPTVERSION . "</p> --- 147,151 ---- case '0.9.9': ! // From release version v0.9.9 $output[] = "<div class=\"maindark\"> <p>Upgrade from v" . $global_prefs['version'] . " to " . SCRIPTVERSION . "</p> *************** *** 153,157 **** <p>"; ! // include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; --- 154,158 ---- <p>"; ! include 'system/upgrade.1.0.inc.php'; $res = updateversion(SCRIPTVERSION); $output[] = "Updating version field to " . SCRIPTVERSION . " ....... " . (!PEAR::isError($res) ? "Success!" : $res->getMessage()) . "<BR />\n"; |