From: stronk7 Date: Thu, 21 Sep 2006 09:54:00 +0000 (+0000) Subject: Last reserved word is out now! X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0bc94c999017afbad47935f09c5afcf3d5627c16;p=moodle.git Last reserved word is out now! journal_entries->comment to entrycomment Only 2 tables have reserved names but they aren't a problem if we force $CFG->prefix always --- diff --git a/mod/journal/backuplib.php b/mod/journal/backuplib.php index 91c402f0a0..bf47f88fc1 100644 --- a/mod/journal/backuplib.php +++ b/mod/journal/backuplib.php @@ -94,7 +94,7 @@ fwrite ($bf,full_tag("TEXT",6,false,$jou_ent->text)); fwrite ($bf,full_tag("FORMAT",6,false,$jou_ent->format)); fwrite ($bf,full_tag("RATING",6,false,$jou_ent->rating)); - fwrite ($bf,full_tag("COMMENT",6,false,$jou_ent->comment)); + fwrite ($bf,full_tag("ENTRYCOMMENT",6,false,$jou_ent->entrycomment)); fwrite ($bf,full_tag("TEACHER",6,false,$jou_ent->teacher)); fwrite ($bf,full_tag("TIMEMARKED",6,false,$jou_ent->timemarked)); fwrite ($bf,full_tag("MAILED",6,false,$jou_ent->mailed)); diff --git a/mod/journal/db/install.xml b/mod/journal/db/install.xml index 050743fdd9..72396f350f 100644 --- a/mod/journal/db/install.xml +++ b/mod/journal/db/install.xml @@ -1,5 +1,8 @@ - + @@ -27,9 +30,9 @@ - - - + + + diff --git a/mod/journal/db/migrate2utf8.xml b/mod/journal/db/migrate2utf8.xml index 2ea54faf6c..5759a4e1f7 100755 --- a/mod/journal/db/migrate2utf8.xml +++ b/mod/journal/db/migrate2utf8.xml @@ -16,7 +16,7 @@ AND je.id = RECORDID - + SELECT je.userid FROM {$CFG->prefix}journal_entries je diff --git a/mod/journal/db/mysql.php b/mod/journal/db/mysql.php index 76683c57ac..caf7cd2767 100644 --- a/mod/journal/db/mysql.php +++ b/mod/journal/db/mysql.php @@ -76,6 +76,11 @@ function journal_upgrade($oldversion) { 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', '', '', ''); + } + return $result; } diff --git a/mod/journal/db/mysql.sql b/mod/journal/db/mysql.sql index c542919f75..af95f2149e 100755 --- a/mod/journal/db/mysql.sql +++ b/mod/journal/db/mysql.sql @@ -40,7 +40,7 @@ CREATE TABLE prefix_journal_entries ( text text NOT NULL default '', format tinyint(2) NOT NULL default '0', rating int(10) default '0', - comment text default '', + entrycomment text default '', teacher int(10) unsigned NOT NULL default '0', timemarked int(10) unsigned NOT NULL default '0', mailed int(1) unsigned NOT NULL default '0', diff --git a/mod/journal/db/postgres7.php b/mod/journal/db/postgres7.php index 11fda37df4..ddb2ae4314 100644 --- a/mod/journal/db/postgres7.php +++ b/mod/journal/db/postgres7.php @@ -52,5 +52,9 @@ function journal_upgrade($oldversion) { $wtm->update( 'journal_entries', 'text', 'format', $sql ); } + if ($oldversion < 2006092100) { + table_column('journal_entries', 'comment', 'entrycomment', 'text', '', '', ''); + } + return $result; } diff --git a/mod/journal/db/postgres7.sql b/mod/journal/db/postgres7.sql index f9e2c75c01..5eeb51baf5 100755 --- a/mod/journal/db/postgres7.sql +++ b/mod/journal/db/postgres7.sql @@ -41,7 +41,7 @@ CREATE TABLE prefix_journal_entries ( text text NOT NULL default '', format integer NOT NULL default '0', rating integer default '0', - comment text, + entrycomment text, teacher integer NOT NULL default '0', timemarked integer NOT NULL default '0', mailed integer NOT NULL default '0' diff --git a/mod/journal/lib.php b/mod/journal/lib.php index f433f55174..c1056b44b3 100644 --- a/mod/journal/lib.php +++ b/mod/journal/lib.php @@ -453,7 +453,7 @@ function journal_print_user_entry($course, $user, $entry, $teachers, $grades) { echo "  ".userdate($entry->timemarked).""; } echo "

"; echo ""; } @@ -541,7 +541,7 @@ function journal_print_feedback($course, $entry, $grades) { } echo ''; - echo format_text($entry->comment); + echo format_text($entry->entrycomment); echo '
'; } diff --git a/mod/journal/report.php b/mod/journal/report.php index b3477af947..47f7179b42 100644 --- a/mod/journal/report.php +++ b/mod/journal/report.php @@ -70,9 +70,9 @@ foreach ($feedback as $num => $vals) { $entry = $entrybyentry[$num]; // Only update entries where feedback has actually changed. - if (($vals['r'] <> $entry->rating) || ($vals['c'] <> addslashes($entry->comment))) { + if (($vals['r'] <> $entry->rating) || ($vals['c'] <> addslashes($entry->entrycomment))) { $newentry->rating = $vals['r']; - $newentry->comment = $vals['c']; + $newentry->entrycomment = $vals['c']; $newentry->teacher = $USER->id; $newentry->timemarked = $timenow; $newentry->mailed = 0; // Make sure mail goes out (again, even) @@ -83,7 +83,7 @@ $count++; } $entrybyuser[$entry->userid]->rating = $vals['r']; - $entrybyuser[$entry->userid]->comment = $vals['c']; + $entrybyuser[$entry->userid]->entrycomment = $vals['c']; $entrybyuser[$entry->userid]->teacher = $USER->id; $entrybyuser[$entry->userid]->timemarked = $timenow; } diff --git a/mod/journal/restorelib.php b/mod/journal/restorelib.php index da1a426194..a3e082f2d1 100644 --- a/mod/journal/restorelib.php +++ b/mod/journal/restorelib.php @@ -132,7 +132,11 @@ $entry->text = backup_todb($entry_info['#']['TEXT']['0']['#']); $entry->format = backup_todb($entry_info['#']['FORMAT']['0']['#']); $entry->rating = backup_todb($entry_info['#']['RATING']['0']['#']); - $entry->comment = backup_todb($entry_info['#']['COMMENT']['0']['#']); + if (isset(backup_todb($entry_info['#']['COMMENT']['0']['#']))) { + $entry->entrycomment = backup_todb($entry_info['#']['COMMENT']['0']['#']); + } else { + $entry->entrycomment = backup_todb($entry_info['#']['ENTRYCOMMENT']['0']['#']); + } $entry->teacher = backup_todb($entry_info['#']['TEACHER']['0']['#']); $entry->timemarked = backup_todb($entry_info['#']['TIMEMARKED']['0']['#']); $date = usergetdate($entry->timemarked); diff --git a/mod/journal/version.php b/mod/journal/version.php index a0ad66ace0..037698974e 100644 --- a/mod/journal/version.php +++ b/mod/journal/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2006091201; +$module->version = 2006092100; $module->requires = 2006080900; // Requires this Moodle version $module->cron = 60; diff --git a/mod/journal/view.php b/mod/journal/view.php index 43cccf8b7d..aafb523c6f 100644 --- a/mod/journal/view.php +++ b/mod/journal/view.php @@ -117,7 +117,7 @@ echo userdate($timefinish).''; } - if ($entry->comment or $entry->rating) { + if ($entry->entrycomment or $entry->rating) { $grades = make_grades_menu($journal->assessed); print_heading(get_string('feedback')); journal_print_feedback($course, $entry, $grades);