courseid = 0; $defaultscale->userid = 0; $defaultscale->timemodified = time(); $defaultscale->name = get_string("journalrating2", "journal"); $defaultscale->scale = get_string("journalrating1", "journal").",". get_string("journalrating2", "journal").",". get_string("journalrating3", "journal"); if ($defaultscale->id = insert_record("scale", $defaultscale)) { execute_sql("UPDATE {$CFG->prefix}journal SET assessed = '-$defaultscale->id'", false); } else { notify("An error occurred while inserting the default journal scale"); $result = false; } } if ($oldversion < 2004011400) { table_column("journal", "", "introformat", "integer", "2", "", "1", "not null", "intro"); } if ($oldversion < 2004111200) { execute_sql("ALTER TABLE {$CFG->prefix}journal DROP INDEX course;",false); execute_sql("ALTER TABLE {$CFG->prefix}journal_entries DROP INDEX journal;",false); execute_sql("ALTER TABLE {$CFG->prefix}journal_entries DROP INDEX userid;",false); modify_database('','ALTER TABLE prefix_journal ADD INDEX course (course);'); modify_database('','ALTER TABLE prefix_journal_entries ADD INDEX journal (journal);'); modify_database('','ALTER TABLE prefix_journal_entries ADD INDEX userid (userid);'); } if ($oldversion < 2005041100) { // replace wiki-like with markdown include_once( "$CFG->dirroot/lib/wiki_to_markdown.php" ); $wtm = new WikiToMarkdown(); // journal intro $wtm->update( 'journal','intro','introformat' ); // journal entries $sql = "select course from {$CFG->prefix}journal, {$CFG->prefix}journal_entries "; $sql .= "where {$CFG->prefix}journal.id = {$CFG->prefix}journal_entries.journal "; $sql .= "and {$CFG->prefix}journal_entries.id = "; $wtm->update( 'journal_entries', 'text', 'format', $sql ); } if ($oldversion < 2006042800) { execute_sql("UPDATE {$CFG->prefix}journal SET name='' WHERE name IS NULL"); table_column('journal','name','name','varchar','255','','','not null'); execute_sql("UPDATE {$CFG->prefix}journal SET intro='' WHERE intro IS NULL"); table_column('journal','intro','intro','text','','','','not null'); } if ($oldversion < 2006092100) { table_column('journal_entries', 'comment', 'entrycomment', 'text', '', '', '', 'null'); } ////// DO NOT ADD NEW THINGS HERE!! USE upgrade.php and the lib/ddllib.php functions. return $result; } ?>