PRIMARY KEY (id))");
}
- if ($oldversion < 2004121600) {
+ if ($oldversion < 2004122800) {
+ execute_sql("DROP TABLE {$CFG->prefix}message", false);
+ execute_sql("DROP TABLE {$CFG->prefix}message_read", false);
+ execute_sql("DROP TABLE {$CFG->prefix}message_contacts", false);
+
modify_database('',"CREATE TABLE `prefix_message` (
`id` int(10) unsigned NOT NULL auto_increment,
`useridfrom` int(10) NOT NULL default '0',
`useridto` int(10) NOT NULL default '0',
`message` text NOT NULL,
- `timemodified` int(10) NOT NULL default '0',
+ `timecreated` int(10) NOT NULL default '0',
`messagetype` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `useridfrom` (`useridfrom`),
`useridfrom` int(10) NOT NULL default '0',
`useridto` int(10) NOT NULL default '0',
`message` text NOT NULL,
- `timemodified` int(10) NOT NULL default '0',
+ `timecreated` int(10) NOT NULL default '0',
+ `timeread` int(10) NOT NULL default '0',
`messagetype` varchar(50) NOT NULL default '',
`mailed` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `useridfrom` (`useridfrom`),
KEY `useridto` (`useridto`)
) TYPE=MyISAM COMMENT='Stores all messages that have been read';");
+
+ modify_database('',"CREATE TABLE `prefix_message_contacts` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `userid` int(10) unsigned NOT NULL default '0',
+ `contactid` int(10) unsigned NOT NULL default '0',
+ `blocked` tinyint(1) unsigned NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `usercontact` (`userid`,`contactid`)
+ ) TYPE=MyISAM COMMENT='Maintains lists of relationships between users';");
+
+ modify_database('', "INSERT INTO prefix_log_display VALUES ('message', 'write', 'user', 'CONCAT(firstname,\" \",lastname)'); ");
+ modify_database('', "INSERT INTO prefix_log_display VALUES ('message', 'read', 'user', 'CONCAT(firstname,\" \",lastname)'); ");
}
-
+
return $result;
}
`useridfrom` int(10) NOT NULL default '0',
`useridto` int(10) NOT NULL default '0',
`message` text NOT NULL,
- `timemodified` int(10) NOT NULL default '0',
+ `timecreated` int(10) NOT NULL default '0',
`messagetype` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `useridfrom` (`useridfrom`),
`useridfrom` int(10) NOT NULL default '0',
`useridto` int(10) NOT NULL default '0',
`message` text NOT NULL,
- `timemodified` int(10) NOT NULL default '0',
+ `timecreated` int(10) NOT NULL default '0',
+ `timeread` int(10) NOT NULL default '0',
`messagetype` varchar(50) NOT NULL default '',
`mailed` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
) TYPE=MyISAM COMMENT='Stores all messages that have been read';
# --------------------------------------------------------
+#
+# Table structure for table `message_contacts`
+#
+
+CREATE TABLE `prefix_message_contacts` (
+ `id` int(10) unsigned NOT NULL auto_increment,
+ `userid` int(10) unsigned NOT NULL default '0',
+ `contactid` int(10) unsigned NOT NULL default '0',
+ `blocked` tinyint(1) unsigned NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `usercontact` (`userid`,`contactid`)
+) TYPE=MyISAM COMMENT='Maintains lists of relationships between users';
+# --------------------------------------------------------
+
#
# Table structure for table `modules`
#
INSERT INTO prefix_log_display VALUES ('course', 'view', 'course', 'fullname');
INSERT INTO prefix_log_display VALUES ('course', 'update', 'course', 'fullname');
INSERT INTO prefix_log_display VALUES ('course', 'enrol', 'course', 'fullname');
+INSERT INTO prefix_log_display VALUES ('message', 'write', 'user', 'CONCAT(firstname," ",lastname)');
+INSERT INTO prefix_log_display VALUES ('message', 'read', 'user', 'CONCAT(firstname," ",lastname)');
next_change integer NOT NULL default '0',
current_offset integer NOT NULL default '0'
);");
+ }
+
+ if ($oldversion < 2004122800) {
+ execute_sql("DROP TABLE {$CFG->prefix}message", false);
+ execute_sql("DROP TABLE {$CFG->prefix}message_read", false);
+ execute_sql("DROP TABLE {$CFG->prefix}message_contacts", false);
+ execute_sql("DROP INDEX {$CFG->prefix}message_useridfrom_idx", false);
+ execute_sql("DROP INDEX {$CFG->prefix}message_useridto_idx", false);
+ execute_sql("DROP INDEX {$CFG->prefix}message_read_useridfrom_idx", false);
+ execute_sql("DROP INDEX {$CFG->prefix}message_read_useridto_idx", false);
+ execute_sql("DROP INDEX {$CFG->prefix}message_contacts_useridcontactid_idx", false);
modify_database('',"CREATE TABLE prefix_message (
id SERIAL PRIMARY KEY,
useridfrom integer NOT NULL default '0',
useridto integer NOT NULL default '0',
message text,
- timemodified integer NOT NULL default '0',
+ timecreated integer NOT NULL default '0',
messagetype varchar(50) NOT NULL default ''
);
useridfrom integer NOT NULL default '0',
useridto integer NOT NULL default '0',
message text,
- timemodified integer NOT NULL default '0',
+ timecreated integer NOT NULL default '0',
+ timeread integer NOT NULL default '0',
messagetype varchar(50) NOT NULL default '',
mailed integer NOT NULL default '0'
);
CREATE INDEX prefix_message_read_useridfrom_idx ON prefix_message_read (useridfrom);
CREATE INDEX prefix_message_read_useridto_idx ON prefix_message_read (useridto);
");
+
+ modify_database('',"CREATE TABLE prefix_message_contacts (
+ id SERIAL PRIMARY KEY,
+ userid integer NOT NULL default '0',
+ contactid integer NOT NULL default '0',
+ blocked integer NOT NULL default '0'
+ );
+
+ CREATE INDEX prefix_message_contacts_useridcontactid_idx ON prefix_message_contacts (userid,contactid);
+ ");
+
+ modify_database('',"INSERT INTO prefix_log_display VALUES ('message', 'write', 'user', 'firstname||\' \'||lastname');
+ INSERT INTO prefix_log_display VALUES ('message', 'read', 'user', 'firstname||\' \'||lastname');
+ ");
}
+
return $result;
}
useridfrom integer NOT NULL default '0',
useridto integer NOT NULL default '0',
message text,
- timemodified integer NOT NULL default '0',
+ timecreated integer NOT NULL default '0',
messagetype varchar(50) NOT NULL default ''
);
useridfrom integer NOT NULL default '0',
useridto integer NOT NULL default '0',
message text,
- timemodified integer NOT NULL default '0',
+ timecreated integer NOT NULL default '0',
+ timeread integer NOT NULL default '0',
messagetype varchar(50) NOT NULL default '',
mailed integer NOT NULL default '0'
);
CREATE INDEX prefix_message_read_useridfrom_idx ON prefix_message_read (useridfrom);
CREATE INDEX prefix_message_read_useridto_idx ON prefix_message_read (useridto);
+CREATE TABLE prefix_message_contacts (
+ id SERIAL PRIMARY KEY,
+ userid integer NOT NULL default '0',
+ contactid integer NOT NULL default '0',
+ blocked integer NOT NULL default '0'
+);
+
+CREATE INDEX prefix_message_contacts_useridcontactid_idx ON prefix_message_contacts (userid,contactid);
+
CREATE TABLE prefix_modules (
id SERIAL PRIMARY KEY,
name varchar(20) NOT NULL default '',
INSERT INTO prefix_log_display VALUES ('course', 'view', 'course', 'fullname');
INSERT INTO prefix_log_display VALUES ('course', 'update', 'course', 'fullname');
INSERT INTO prefix_log_display VALUES ('course', 'enrol', 'course', 'fullname');
+INSERT INTO prefix_log_display VALUES ('message', 'write', 'user', 'firstname||\' \'||lastname');
+INSERT INTO prefix_log_display VALUES ('message', 'read', 'user', 'firstname||\' \'||lastname');
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
- $version = 2004121600; // YYYYMMDD = date of first major branch release 1.4
+ $version = 2004122800; // YYYYMMDD = date of first major branch release 1.4
// XY = increments within a single day
$release = '1.5 UNSTABLE DEVELOPMENT'; // Human-friendly version name