Commit c9a28d0a authored by Donal McMullan's avatar Donal McMullan
Browse files
parents e48f4878 5b12f475
mahara (0.8.0~dew) unstable; urgency=low
* 0.8.0 Dev version
-- Penny Leach <penny@catalyst.net.nz> Mon, 23 Apr 2007 09:09:51 +1200
mahara (0.7.0~dev) unstable; urgency=low
* 0.7.0 Dev version
......
......@@ -27,7 +27,7 @@
</TABLE>
<TABLE NAME="artefact_file_file_types">
<FIELDS>
<FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="true"/>
<FIELD NAME="description" TYPE="char" LENGTH="32" NOTNULL="true"/>
<FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1"/>
</FIELDS>
<KEYS>
......@@ -36,8 +36,8 @@
</TABLE>
<TABLE NAME="artefact_file_mime_types">
<FIELDS>
<FIELD NAME="mimetype" TYPE="text" LENGTH="small" NOTNULL="true"/>
<FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="true"/>
<FIELD NAME="mimetype" TYPE="char" LENGTH="128" NOTNULL="true"/>
<FIELD NAME="description" TYPE="char" LENGTH="32" NOTNULL="true"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="mimetype"/>
......
......@@ -122,6 +122,16 @@ function xmldb_artefact_file_upgrade($oldversion=0) {
add_field($table, $field);
}
if ($oldversion < 2007042500) {
// migrate everything we had to change to make mysql happy
$prefix = get_config('dbprefix');
execute_sql("ALTER TABLE {$prefix}artefact_file_file_types ALTER COLUMN description TYPE varchar(32)");
execute_sql("ALTER TABLE {$prefix}artefact_file_mime_types ALTER COLUMN mimetype TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}artefact_file_mime_types ALTER COLUMN description TYPE varchar(32)");
}
// everything up to here we pre mysql support.
return $status;
}
......
......@@ -181,6 +181,7 @@ class PluginArtefactFile extends PluginArtefact {
// list, add it to the current list.
foreach ($filetypes as $filetype) {
$type = $filetype['#']['description'][0]['#'];
error_log("looking for $type");
if (!in_array($type, $currentlist)) {
log_debug('Adding filetype: ' . $type);
$currentlist[] = $type;
......@@ -384,8 +385,8 @@ abstract class ArtefactTypeFileBase extends ArtefactType {
$filedata = get_records_sql_array('
SELECT
a.id, a.artefacttype, a.mtime, f.size, a.title, a.description,
COUNT(c.*) AS childcount '
. ($bloginstalled ? ', COUNT (b.*) AS attachcount' : '') . '
COUNT(c.id) AS childcount '
. ($bloginstalled ? ', COUNT (b.blogpost) AS attachcount' : '') . '
FROM ' . $prefix . 'artefact a
LEFT OUTER JOIN ' . $prefix . 'artefact_file_files f ON f.artefact = a.id
LEFT OUTER JOIN ' . $prefix . 'artefact c ON c.parent = a.id '
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007021401;
$config->version = 2007042500;
$config->release = '0.3.1';
?>
......@@ -20,7 +20,7 @@
<TABLE NAME="artefact_internal_profile_email">
<FIELDS>
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="email" TYPE="text" NOTNULL="true" />
<FIELD NAME="email" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="verified" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="principal" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="artefact" TYPE="int" LENGTH="10" NOTNULL="false" />
......@@ -36,7 +36,7 @@
<TABLE NAME="artefact_internal_profile_icon">
<FIELDS>
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="filename" TYPE="text" NOTNULL="true" />
<FIELD NAME="filename" TYPE="char" LENGTH="255" NOTNULL="true" />
<FIELD NAME="primary" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
</FIELDS>
<KEYS>
......
......@@ -30,6 +30,15 @@ function xmldb_artefact_internal_upgrade($oldversion=0) {
$status = true;
if ($oldversion < 2007042500) {
// migrate everything we had to change to make mysql happy
$prefix = get_config('dbprefix');
execute_sql("ALTER TABLE {$prefix}artefact_internal_profile_email ALTER COLUMN email TYPE varchar(255)");
execute_sql("ALTER TABLE {$prefix}artefact_internal_profile_icon ALTER COLUMN filename TYPE varchar(255)");
}
// everything up to here we pre mysql support.
return $status;
}
......
......@@ -29,7 +29,7 @@ define('JSON', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
$prefix = get_config('dbprefix');
$result = get_records_sql_array('SELECT a.id, a.title, a.note, (u.profileicon = a.id) AS default
$result = get_records_sql_array('SELECT a.id, a.title, a.note, (u.profileicon = a.id) AS isdefault
FROM ' . $prefix . 'artefact a
LEFT OUTER JOIN ' . $prefix . 'usr u
ON (u.id = a.owner)
......
......@@ -108,7 +108,7 @@ var table = new TableRenderer(
'name': 'd',
'value': rowdata.id
};
if (rowdata['default'] == 't') {
if (rowdata['isdefault'] == 't' || rowdata['isdefault'] == 1) {
options.checked = 'checked';
}
return TD({'class': 'center'}, INPUT(options));
......
......@@ -27,7 +27,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2007010800;
$config->version = 2007042500;
$config->release = '0.1';
?>
......@@ -51,7 +51,7 @@ $createcommunity = pieform(array(
'name' => array(
'type' => 'text',
'title' => get_string('communityname'),
'rules' => array( 'required' => true ),
'rules' => array( 'required' => true, 'maxlength' => 128 ),
),
'description' => array(
'type' => 'wysiwyg',
......@@ -92,8 +92,6 @@ function createcommunity_submit(Pieform $form, $values) {
global $USER;
global $SESSION;
log_debug($values);
db_begin();
$now = db_format_timestamp(time());
......
......@@ -59,7 +59,7 @@ $editcommunity = pieform(array(
'name' => array(
'type' => 'text',
'title' => get_string('communityname'),
'rules' => array( 'required' => true ),
'rules' => array( 'required' => true, 'maxlength' => 128 ),
'defaultvalue' => $community_data->name,
),
'description' => array(
......@@ -110,8 +110,6 @@ function editcommunity_submit(Pieform $form, $values) {
$now = db_format_timestamp(time());
log_debug($values);
update_record(
'community',
(object) array(
......
......@@ -41,7 +41,7 @@ $userid = $USER->get('id');
if (empty($owned)) { // just get communities this user is a member of.
$data = get_member_communities($userid, $offset, $limit);
$count = get_record_sql('SELECT COUNT(c.*)
$count = get_record_sql('SELECT COUNT(distinct c.id) AS count
FROM ' . $prefix . 'community c
JOIN ' . $prefix . 'community_member cm ON cm.community = c.id
WHERE c.owner != ? AND cm.member = ?', array($userid, $userid));
......@@ -52,7 +52,7 @@ else {
$count = count_records_sql('SELECT COUNT(*) FROM ' . $prefix . 'community c WHERE c.owner = ?',
array($userid));
$datasql = 'SELECT c.id,c.jointype,c.name,c.owner,count(cmr.community) as requestcount, COUNT(v.*) AS hasviews
$datasql = 'SELECT c.id,c.jointype,c.name,c.owner,count(distinct cmr.community) as requestcount, COUNT(distinct v.view) AS hasviews
FROM ' . $prefix . 'community c
LEFT JOIN ' . $prefix . 'community_member_request cmr ON cmr.community = c.id
LEFT JOIN ' . $prefix . 'view_access_community v ON v.community = c.id
......
......@@ -56,7 +56,7 @@ switch ($type) {
$where = 'WHERE v.submittedto = ?';
$values = array($id);
if (!$submitted) {
$where .= 'OR (
$where .= ' OR (
a.community = ?
AND ( v.startdate IS NULL OR v.startdate < ? )
AND ( v.stopdate IS NULL OR v.stopdate > ? )
......@@ -71,7 +71,7 @@ switch ($type) {
}
$count = count_records_sql('
SELECT COUNT(v.id)
SELECT COUNT(id)
FROM ' . $prefix . 'view v
LEFT OUTER JOIN ' . $prefix . 'view_access_community a ON a.view=v.id
' . $where,
......
......@@ -55,7 +55,7 @@ if ($action == 'delete') {
else {
$count = get_field('usr_group', 'COUNT(*)', 'owner', $USER->get('id'));
$data = get_records_sql_array(
'SELECT g.id, g.name, COUNT(m.*) AS count, (SELECT COUNT(*) FROM ' . $dbprefix . 'view_access_group vag WHERE vag.grp=g.id) FROM ' . $dbprefix . 'usr_group g INNER JOIN ' . $dbprefix . 'usr_group_member m ON m.grp=g.id WHERE g.owner=? GROUP BY 1, 2 ORDER BY g.name',
'SELECT g.id, g.name, COUNT(m.grp) AS count, (SELECT COUNT(*) FROM ' . $dbprefix . 'view_access_group vag WHERE vag.grp=g.id) FROM ' . $dbprefix . 'usr_group g INNER JOIN ' . $dbprefix . 'usr_group_member m ON m.grp=g.id WHERE g.owner=? GROUP BY 1, 2 ORDER BY g.name',
array($USER->get('id')),
$offset,
$limit
......
......@@ -83,6 +83,7 @@ try {
ob_start();
$db = &ADONewConnection($CFG->dbtype);
$dbgenerator = null;
if (!empty($CFG->dbport)) {
$CFG->dbhost .= ':'.$CFG->dbport;
}
......
......@@ -515,11 +515,19 @@ function activity_get_viewaccess_users($view, $owner, $type) {
UNION SELECT usr AS userid
FROM ' . $prefix . 'view_access_usr u
WHERE u.view = ?
UNION SELECT m.member
FROM ' . $prefix . 'community_member m
JOIN ' . $prefix . 'view_access_community c ON c.community = m.community
WHERE c.view = ? AND (c.tutoronly = ? OR m.tutor = ?)
UNION SELECT c.owner
FROM ' . $prefix . 'community c
JOIN ' . $prefix . 'view_access_community ac ON ac.community = c.id
WHERE ac.view = ?
) AS userlist
JOIN ' . $prefix . 'usr u ON u.id = userlist.userid
LEFT JOIN ' . $prefix . 'usr_activity_preference p ON p.usr = u.id
WHERE p.activity = ?';
$values = array($owner, $owner, $owner, 'friends', $view, $view, $view, $type);
$values = array($owner, $owner, $owner, 'friends', $view, $view, $view, $view, 0, 1, $view, $type);
if (!$u = get_records_sql_assoc($sql, $values)) {
$u = array();
}
......
......@@ -78,7 +78,7 @@ function get_member_communities($userid=0, $offset=0, $limit=0) {
$userid = optional_userid($userid);
$prefix = get_config('dbprefix');
return get_records_sql_array('SELECT c.id, c.name, c.description, c.jointype, c.owner, c.ctime, c.mtime, cm.ctime, cm.tutor, COUNT(v.*) AS hasviews
return get_records_sql_array('SELECT c.id, c.name, c.description, c.jointype, c.owner, c.ctime, c.mtime, cm.ctime, cm.tutor, COUNT(v.view) AS hasviews
FROM ' . $prefix . 'community c
JOIN ' . $prefix . 'community_member cm ON cm.community = c.id
LEFT JOIN ' . $prefix . 'view_access_community v ON v.community = c.id
......
......@@ -141,7 +141,8 @@
<FIELD NAME="dayofweek" TYPE="char" LENGTH="25" NOTNULL="true" DEFAULT="*" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="callfunction" />
<KEY NAME="primary" TYPE="primary" FIELDS="id" />
<KEY NAME="callfunctionuk" TYPE="unique" FIELDS="callfunction" />
</KEYS>
</TABLE>
<TABLE NAME="activity_type">
......@@ -425,7 +426,7 @@
<TABLE NAME="community">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" />
<FIELD NAME="name" TYPE="text" NOTNULL="true" />
<FIELD NAME="name" TYPE="char" LENGTH="128" NOTNULL="true" />
<FIELD NAME="description" TYPE="text" NOTNULL="false" />
<FIELD NAME="jointype" TYPE="char" LENGTH="20" NOTNULL="true" ENUM="true" ENUMVALUES="'controlled', 'invite', 'request', 'open'" DEFAULT="open" />
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
......@@ -519,7 +520,7 @@
<FIELDS>
<FIELD NAME="usr" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="activity" TYPE="char" LENGTH="100" NOTNULL="true" />
<FIELD NAME="method" TYPE="text" NOTNULL="true" />
<FIELD NAME="method" TYPE="char" LENGTH="255" NOTNULL="true" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="usr,activity" />
......@@ -595,8 +596,8 @@
</TABLE>
<TABLE NAME="template_category">
<FIELDS>
<FIELD NAME="name" TYPE="text" NOTNULL="true" />
<FIELD NAME="parent" TYPE="text" NOTNULL="false" />
<FIELD NAME="name" TYPE="char" LENGTh="128" NOTNULL="true" />
<FIELD NAME="parent" TYPE="char" LENGTH="128" NOTNULL="false" />
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="name" />
......@@ -605,10 +606,10 @@
</TABLE>
<TABLE NAME="template">
<FIELDS>
<FIELD NAME="name" TYPE="text" NOTNULL="true" />
<FIELD NAME="name" TYPE="char" LENGTH="128" NOTNULL="true" />
<FIELD NAME="title" TYPE="text" NOTNULL="true" />
<FIELD NAME="description" TYPE="text" NOTNULL="false" />
<FIELD NAME="category" TYPE="text" NOTNULL="true" />
<FIELD NAME="category" TYPE="char" LENGTH="128" NOTNULL="true" />
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
<FIELD NAME="mtime" TYPE="datetime" NOTNULL="true" />
......@@ -629,7 +630,7 @@
<FIELD NAME="description" TYPE="text" NOTNULL="false" />
<FIELD NAME="owner" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="ownerformat" TYPE="text" NOTNULL="true" />
<FIELD NAME="template" TYPE="text" NOTNULL="true" />
<FIELD NAME="template" TYPE="char" LENGTH="128" NOTNULL="true" />
<FIELD NAME="startdate" TYPE="datetime" />
<FIELD NAME="stopdate" TYPE="datetime" />
<FIELD NAME="ctime" TYPE="datetime" NOTNULL="true" />
......@@ -719,7 +720,7 @@
<TABLE NAME="view_access">
<FIELDS>
<FIELD NAME="view" TYPE="int" LENGTH="10" NOTNULL="true" />
<FIELD NAME="accesstype" TYPE="char" LENGTH="16" NOTNULL="true" ENUM="true" ENUMVALUES="'public', 'loggedin', 'friends'" />
<FIELD NAME="accesstype" TYPE="char" LENGTH="16" NOTNULL="true" ENUM="true" ENUMVALUES="'public', 'loggedin', 'friends'" DEFAULT="public" />
<FIELD NAME="startdate" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="stopdate" TYPE="datetime" NOTNULL="false" />
</FIELDS>
......
......@@ -247,6 +247,23 @@ function xmldb_core_upgrade($oldversion=0) {
upgrade_template('blogandprofile', $template);
}
if ($oldversion < 2007042500) {
// migrate everything we had to change to make mysql happy
execute_sql("ALTER TABLE {$prefix}cron DROP CONSTRAINT {$prefix}cron_cal_pk"); // can't drop primary keys using xmldb...
execute_sql("ALTER TABLE {$prefix}cron ADD CONSTRAINT {$prefix}cron_id_pk PRIMARY KEY (id)"); // or add them!
execute_sql("ALTER TABLE {$prefix}cron ADD CONSTRAINT {$prefix}cron_cal_uk UNIQUE (callfunction)");
execute_sql("ALTER TABLE {$prefix}community ALTER COLUMN name TYPE varchar (128)");
execute_sql("ALTER TABLE {$prefix}usr_activity_preference ALTER COLUMN method TYPE varchar(255)");
execute_sql("ALTER TABLE {$prefix}template_category ALTER COLUMN name TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}template_category ALTER COLUMN parent TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}template ALTER COLUMN name TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}template ALTER COLUMN category TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}view ALTER COLUMN template TYPE varchar(128)");
execute_sql("ALTER TABLE {$prefix}view_access ALTER COLUMN accesstype SET DEFAULT 'public'");
}
// everything up to here we pre mysql support.
return $status;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment