Merged from MOODLE_15_STABLE: fixing bug 3569: current workaround= one query for postgres, one for mysql. probably a better way to do it when someone has more time
This commit is contained in:
+16
-1
@@ -1278,7 +1278,9 @@ function forum_get_discussions($forum="0", $forumsort="d.timemodified DESC",
|
||||
$umtable = ' LEFT JOIN '.$CFG->prefix.'user um on (d.usermodified = um.id)';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT $postdata, d.name, d.timemodified, d.usermodified, d.groupid,
|
||||
//TODO: there must be a nice way to do this that keeps both postgres and mysql 3.2x happy but I can't find it right now.
|
||||
if ($CFG->dbtype == 'postgres7') {
|
||||
return get_records_sql("SELECT $postdata, d.name, d.timemodified, d.usermodified, d.groupid,
|
||||
u.firstname, u.lastname, u.email, u.picture $umfields
|
||||
FROM {$CFG->prefix}forum_discussions d
|
||||
JOIN {$CFG->prefix}forum_posts p ON p.discussion = d.id
|
||||
@@ -1288,6 +1290,19 @@ function forum_get_discussions($forum="0", $forumsort="d.timemodified DESC",
|
||||
AND p.parent = 0
|
||||
$groupselect $userselect
|
||||
ORDER BY $forumsort $limit");
|
||||
} else {
|
||||
return get_records_sql("SELECT $postdata, d.name, d.timemodified, d.usermodified, d.groupid,
|
||||
u.firstname, u.lastname, u.email, u.picture $umfields
|
||||
FROM {$CFG->prefix}forum_discussions d,
|
||||
{$CFG->prefix}forum_posts p,
|
||||
{$CFG->prefix}user u
|
||||
$umtable
|
||||
WHERE d.forum = '$forum'
|
||||
AND p.discussion = d.id
|
||||
AND p.parent = 0
|
||||
AND p.userid = u.id $groupselect $userselect
|
||||
ORDER BY $forumsort $limit");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user