moodle/mod/forum/db/postgres7.php
moodler d05956ac9f Some improvements in efficiency of Recent Activity.
There is now a new field in forum_discussions which has the userid
of the author in it.  This saves a lookup every time to forum_posts.

There is also some caching and rearrangement of the logic.

It seems to work OK, I'm about to do some speed tests on moodle.org
2004-01-14 11:50:29 +00:00

50 lines
1.5 KiB
PHP

<?PHP // $Id$
function forum_upgrade($oldversion) {
// This function does anything necessary to upgrade
// older versions to match current functionality
global $CFG;
if ($oldversion < 2003042402) {
execute_sql("INSERT INTO {$CFG->prefix}log_display VALUES ('forum', 'move discussion', 'forum_discussions', 'name')");
}
if ($oldversion < 2003082500) {
table_column("forum", "", "assesstimestart", "integer", "10", "unsigned", "0", "", "assessed");
table_column("forum", "", "assesstimefinish", "integer", "10", "unsigned", "0", "", "assesstimestart");
}
if ($oldversion < 2003082502) {
execute_sql("UPDATE {$CFG->prefix}forum SET scale = (- scale)");
}
if ($oldversion < 2003100600) {
table_column("forum", "", "maxbytes", "integer", "10", "unsigned", "0", "", "scale");
}
if ($oldversion < 2004010100) {
table_column("forum", "", "assesspublic", "integer", "4", "unsigned", "0", "", "assessed");
}
if ($oldversion < 2004011404) {
table_column("forum_discussions", "", "userid", "integer", "10", "unsigned", "0", "", "firstpost");
if ($discussions = get_records_sql("SELECT d.id, p.userid
FROM {$CFG->prefix}forum_discussions as d,
{$CFG->prefix}forum_posts as p
WHERE d.firstpost = p.id")) {
foreach ($discussions as $discussion) {
update_record("forum_discussions", $discussion);
}
}
}
return true;
}
?>