Skip to content
Snippets Groups Projects
Commit 1643e0d1 authored by Peter Rotich's avatar Peter Rotich
Browse files

Change session ID field to varchar(256) - to support 1024-bit hashes

Make collation consistent - utf8_general_ci.
parent 14efd716
Branches
Tags
No related merge requests found
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
return ($database && @mysql_select_db($database)); return ($database && @mysql_select_db($database));
} }
function db_create_database($database, $charset='utf8', $collate='utf8_unicode_ci') { function db_create_database($database, $charset='utf8', $collate='utf8_general_ci') {
return @mysql_query(sprintf('CREATE DATABASE %s DEFAULT CHARACTER SET %s COLLATE %s', $database, $charset, $collate)); return @mysql_query(sprintf('CREATE DATABASE %s DEFAULT CHARACTER SET %s COLLATE %s', $database, $charset, $collate));
} }
......
...@@ -10,7 +10,7 @@ CREATE TABLE `%TABLE_PREFIX%group_dept_access` ( ...@@ -10,7 +10,7 @@ CREATE TABLE `%TABLE_PREFIX%group_dept_access` (
`dept_id` int(10) unsigned NOT NULL default '0', `dept_id` int(10) unsigned NOT NULL default '0',
UNIQUE KEY `group_dept` (`group_id`,`dept_id`), UNIQUE KEY `group_dept` (`group_id`,`dept_id`),
KEY `dept_id` (`dept_id`) KEY `dept_id` (`dept_id`)
) ENGINE=MyISAM; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- Extend membership to groups -- Extend membership to groups
ALTER TABLE `%TABLE_PREFIX%department` ALTER TABLE `%TABLE_PREFIX%department`
......
...@@ -143,7 +143,7 @@ CREATE TABLE `%TABLE_PREFIX%api_key` ( ...@@ -143,7 +143,7 @@ CREATE TABLE `%TABLE_PREFIX%api_key` (
`created` datetime NOT NULL default '0000-00-00 00:00:00', `created` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `ipaddr` (`ipaddr`) UNIQUE KEY `ipaddr` (`ipaddr`)
) ENGINE=MyISAM; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `%TABLE_PREFIX%syslog`; DROP TABLE IF EXISTS `%TABLE_PREFIX%syslog`;
CREATE TABLE `%TABLE_PREFIX%syslog` ( CREATE TABLE `%TABLE_PREFIX%syslog` (
...@@ -157,7 +157,7 @@ CREATE TABLE `%TABLE_PREFIX%syslog` ( ...@@ -157,7 +157,7 @@ CREATE TABLE `%TABLE_PREFIX%syslog` (
`updated` datetime NOT NULL default '0000-00-00 00:00:00', `updated` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`log_id`), PRIMARY KEY (`log_id`),
KEY `log_type` (`log_type`) KEY `log_type` (`log_type`)
) ENGINE=MyISAM; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
UPDATE `%TABLE_PREFIX%config` UPDATE `%TABLE_PREFIX%config`
SET `ostversion`='1.6 RC5'; SET `ostversion`='1.6 RC5';
/** /**
* @version v1.7 * @version v1.7
* *
* @schema d5339caebcfbdcca7d57be5b17f804ee * @schema c0fd16f4eaf99b920be9f7fc6ebead32
*/ */
-- increate varchar size for various fields... based on feedback from users. -- Increment varchar size for various fields... based on feedback from users.
ALTER TABLE `%TABLE_PREFIX%session` ALTER TABLE `%TABLE_PREFIX%session`
CHANGE `session_id` `session_id` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''; CHANGE `session_id` `session_id` VARCHAR( 256 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `%TABLE_PREFIX%ticket` ALTER TABLE `%TABLE_PREFIX%ticket`
CHANGE `name` `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `name` `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
...@@ -25,4 +25,4 @@ ALTER TABLE `%TABLE_PREFIX%department` ...@@ -25,4 +25,4 @@ ALTER TABLE `%TABLE_PREFIX%department`
CHANGE `dept_name` `dept_name` VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''; CHANGE `dept_name` `dept_name` VARCHAR( 128 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
UPDATE `%TABLE_PREFIX%config` UPDATE `%TABLE_PREFIX%config`
SET `schema_signature`='d5339caebcfbdcca7d57be5b17f804ee'; SET `schema_signature`='c0fd16f4eaf99b920be9f7fc6ebead32';
...@@ -88,7 +88,7 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%sla` ( ...@@ -88,7 +88,7 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%sla` (
`updated` datetime NOT NULL, `updated` datetime NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`) UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- Create a default SLA -- Create a default SLA
INSERT INTO `%TABLE_PREFIX%sla` (`isactive`, `enable_priority_escalation`, INSERT INTO `%TABLE_PREFIX%sla` (`isactive`, `enable_priority_escalation`,
...@@ -109,7 +109,7 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%team` ( ...@@ -109,7 +109,7 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%team` (
UNIQUE KEY `name` (`name`), UNIQUE KEY `name` (`name`),
KEY `isnabled` (`isenabled`), KEY `isnabled` (`isenabled`),
KEY `lead_id` (`lead_id`) KEY `lead_id` (`lead_id`)
) ENGINE=MyISAM; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- Create a default TEAM -- Create a default TEAM
INSERT INTO `%TABLE_PREFIX%team` (`lead_id`, `isenabled`, `noalerts`, `name`, `notes`, `created`, `updated`) INSERT INTO `%TABLE_PREFIX%team` (`lead_id`, `isenabled`, `noalerts`, `name`, `notes`, `created`, `updated`)
...@@ -121,7 +121,7 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%team_member` ( ...@@ -121,7 +121,7 @@ CREATE TABLE IF NOT EXISTS `%TABLE_PREFIX%team_member` (
`staff_id` int(10) unsigned NOT NULL, `staff_id` int(10) unsigned NOT NULL,
`updated` datetime NOT NULL, `updated` datetime NOT NULL,
PRIMARY KEY (`team_id`,`staff_id`) PRIMARY KEY (`team_id`,`staff_id`)
) ENGINE=MyISAM; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `%TABLE_PREFIX%department` ALTER TABLE `%TABLE_PREFIX%department`
ADD sla_id INT UNSIGNED NOT NULL DEFAULT '0' AFTER tpl_id; ADD sla_id INT UNSIGNED NOT NULL DEFAULT '0' AFTER tpl_id;
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
#Current version && schema signature (Changes from version to version) #Current version && schema signature (Changes from version to version)
define('THIS_VERSION','1.7-RC4+'); //Shown on admin panel define('THIS_VERSION','1.7-RC4+'); //Shown on admin panel
define('SCHEMA_SIGNATURE','d5339caebcfbdcca7d57be5b17f804ee'); //MD5 signature of the db schema. (used to trigger upgrades) define('SCHEMA_SIGNATURE', 'c0fd16f4eaf99b920be9f7fc6ebead32'); //MD5 signature of the db schema. (used to trigger upgrades)
#load config info #load config info
$configfile=''; $configfile='';
if(file_exists(ROOT_DIR.'ostconfig.php')) //Old installs prior to v 1.6 RC5 if(file_exists(ROOT_DIR.'ostconfig.php')) //Old installs prior to v 1.6 RC5
......
...@@ -95,6 +95,9 @@ class Installer extends SetupWizard { ...@@ -95,6 +95,9 @@ class Installer extends SetupWizard {
if(mysql_query($sql)) { if(mysql_query($sql)) {
$this->errors['err'] = 'We have a problem - another installation with same table prefix exists!'; $this->errors['err'] = 'We have a problem - another installation with same table prefix exists!';
$this->errors['prefix'] = 'Prefix already in-use'; $this->errors['prefix'] = 'Prefix already in-use';
} else {
//Try changing charset and collation of the DB - no bigie if we fail.
mysql_query('ALTER DATABASE '.$vars['dbname'].' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
} }
} }
} }
......
...@@ -383,7 +383,7 @@ CREATE TABLE `%TABLE_PREFIX%group_dept_access` ( ...@@ -383,7 +383,7 @@ CREATE TABLE `%TABLE_PREFIX%group_dept_access` (
`dept_id` int(10) unsigned NOT NULL default '0', `dept_id` int(10) unsigned NOT NULL default '0',
UNIQUE KEY `group_dept` (`group_id`,`dept_id`), UNIQUE KEY `group_dept` (`group_id`,`dept_id`),
KEY `dept_id` (`dept_id`) KEY `dept_id` (`dept_id`)
) ENGINE=MyISAM; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `%TABLE_PREFIX%group_dept_access` (`group_id`, `dept_id`) VALUES INSERT INTO `%TABLE_PREFIX%group_dept_access` (`group_id`, `dept_id`) VALUES
(1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (3, 2); (1, 1), (1, 2), (2, 1), (2, 2), (3, 1), (3, 2);
...@@ -449,7 +449,7 @@ INSERT INTO `%TABLE_PREFIX%canned_attachment` (`canned_id`, `file_id`) VALUES (1 ...@@ -449,7 +449,7 @@ INSERT INTO `%TABLE_PREFIX%canned_attachment` (`canned_id`, `file_id`) VALUES (1
DROP TABLE IF EXISTS `%TABLE_PREFIX%session`; DROP TABLE IF EXISTS `%TABLE_PREFIX%session`;
CREATE TABLE `%TABLE_PREFIX%session` ( CREATE TABLE `%TABLE_PREFIX%session` (
`session_id` varchar(255) collate utf8_unicode_ci NOT NULL default '', `session_id` varchar(256) collate utf8_unicode_ci NOT NULL default '',
`session_data` longtext collate utf8_unicode_ci, `session_data` longtext collate utf8_unicode_ci,
`session_expire` datetime default NULL, `session_expire` datetime default NULL,
`session_updated` datetime default NULL, `session_updated` datetime default NULL,
...@@ -558,7 +558,7 @@ CREATE TABLE `%TABLE_PREFIX%team_member` ( ...@@ -558,7 +558,7 @@ CREATE TABLE `%TABLE_PREFIX%team_member` (
`staff_id` int(10) unsigned NOT NULL, `staff_id` int(10) unsigned NOT NULL,
`updated` datetime NOT NULL, `updated` datetime NOT NULL,
PRIMARY KEY (`team_id`,`staff_id`) PRIMARY KEY (`team_id`,`staff_id`)
) ENGINE=MyISAM; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `%TABLE_PREFIX%ticket`; DROP TABLE IF EXISTS `%TABLE_PREFIX%ticket`;
CREATE TABLE `%TABLE_PREFIX%ticket` ( CREATE TABLE `%TABLE_PREFIX%ticket` (
......
d5339caebcfbdcca7d57be5b17f804ee c0fd16f4eaf99b920be9f7fc6ebead32
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment