mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
Changes throughout Moodle to remove any reserved words from the
Moodle tables. ie user -> userid in many tables, plus in user_students start -> starttime and end -> endtime I've just done all this as carefully as I could ... I don't think I missed anything but it's pretty intensive work and I'd be fooling myself if I didn't think I'd missed a couple. Note that this version should pretty much be able to bootstrap itself using PostgreSQL now ... but this is untested
This commit is contained in:
parent
1f48942e7d
commit
ebc3bd2b24
68 changed files with 277 additions and 461 deletions
|
@ -14,6 +14,10 @@ function journal_upgrade($oldversion) {
|
|||
if ($oldversion < 2002101200) {
|
||||
execute_sql(" ALTER TABLE `journal_entries` ADD `format` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL AFTER `text` ");
|
||||
}
|
||||
if ($oldversion < 2002122300) {
|
||||
execute_sql("ALTER TABLE `journal_entries` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ CREATE TABLE prefix_journal (
|
|||
CREATE TABLE prefix_journal_entries (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
journal int(10) unsigned NOT NULL default '0',
|
||||
user int(10) unsigned NOT NULL default '0',
|
||||
userid int(10) unsigned NOT NULL default '0',
|
||||
modified int(10) unsigned NOT NULL default '0',
|
||||
text text NOT NULL,
|
||||
format tinyint(2) NOT NULL default '0',
|
||||
|
|
|
@ -6,14 +6,5 @@ function journal_upgrade($oldversion) {
|
|||
|
||||
$result = true;
|
||||
|
||||
if ($oldversion < 20020810) {
|
||||
if (! execute_sql("ALTER TABLE `journal_entries` ADD `mailed` INTEGER DEFAULT '0' NOT NULL")) {
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
if ($oldversion < 2002101200) {
|
||||
execute_sql(" ALTER TABLE `journal_entries` ADD `format` INTEGER DEFAULT '0' NOT NULL AFTER `text` ");
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ CREATE TABLE journal (
|
|||
CREATE TABLE journal_entries (
|
||||
id SERIAL PRIMARY KEY,
|
||||
journal integer NOT NULL default '0',
|
||||
"user" integer NOT NULL default '0',
|
||||
userid integer NOT NULL default '0',
|
||||
modified integer NOT NULL default '0',
|
||||
text text NOT NULL default '',
|
||||
format integer NOT NULL default '0',
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
$entry = get_record("journal_entries", "user", $USER->id, "journal", $journal->id);
|
||||
$entry = get_record("journal_entries", "userid", $USER->id, "journal", $journal->id);
|
||||
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
@ -43,7 +43,7 @@
|
|||
}
|
||||
add_to_log($course->id, "journal", "update entry", "view.php?id=$cm->id", "$newentry->id");
|
||||
} else {
|
||||
$newentry->user = $USER->id;
|
||||
$newentry->userid = $USER->id;
|
||||
$newentry->journal = $journal->id;
|
||||
$newentry->modified = $timenow;
|
||||
$newentry->text = $text;
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
foreach ($journals as $journal) {
|
||||
|
||||
$entrytext = get_field("journal_entries", "text", "user", $USER->id, "journal", $journal->id");
|
||||
$entrytext = get_field("journal_entries", "text", "userid", $USER->id, "journal", $journal->id");
|
||||
|
||||
$journal->timestart = $course->startdate + (($journal->section - 1) * 608400);
|
||||
if ($journal->daysopen) {
|
||||
|
|
|
@ -9,7 +9,7 @@ $JOURNAL_RATING = array ("3" => get_string("journalrating3", "journal"),
|
|||
// STANDARD MODULE FUNCTIONS /////////////////////////////////////////////////////////
|
||||
|
||||
function journal_user_outline($course, $user, $mod, $journal) {
|
||||
if ($entry = get_record("journal_entries", "user", $user->id, "journal", $journal->id)) {
|
||||
if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) {
|
||||
|
||||
$numwords = count(preg_split("/\w\b/", $entry->text)) - 1;
|
||||
|
||||
|
@ -23,7 +23,7 @@ function journal_user_outline($course, $user, $mod, $journal) {
|
|||
|
||||
function journal_user_complete($course, $user, $mod, $journal) {
|
||||
|
||||
if ($entry = get_record("journal_entries", "user", $user->id, "journal", $journal->id)) {
|
||||
if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) {
|
||||
|
||||
print_simple_box_start();
|
||||
if ($entry->modified) {
|
||||
|
@ -58,8 +58,8 @@ function journal_cron () {
|
|||
|
||||
echo "Processing journal entry $entry->id\n";
|
||||
|
||||
if (! $user = get_record("user", "id", "$entry->user")) {
|
||||
echo "Could not find user $post->user\n";
|
||||
if (! $user = get_record("user", "id", "$entry->userid")) {
|
||||
echo "Could not find user $entry->userid\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ function journal_grades($journalid) {
|
|||
/// Must return an array of grades, indexed by user, and a max grade.
|
||||
global $JOURNAL_RATING;
|
||||
|
||||
if ($return->grades = get_records_menu("journal_entries", "journal", $journalid, "", "user,rating")) {
|
||||
if ($return->grades = get_records_menu("journal_entries", "journal", $journalid, "", "userid,rating")) {
|
||||
foreach ($return->grades as $key => $value) {
|
||||
if ($value) {
|
||||
$return->grades[$key] = $JOURNAL_RATING[$value];
|
||||
|
@ -179,9 +179,9 @@ function journal_get_users_done($journal) {
|
|||
{$CFG->prefix}user_students s,
|
||||
{$CFG->prefix}user_teachers t,
|
||||
{$CFG->prefix}journal_entries j
|
||||
WHERE ((s.course = '$journal->course' AND s.user = u.id)
|
||||
OR (t.course = '$journal->course' AND t.user = u.id))
|
||||
AND u.id = j.user
|
||||
WHERE ((s.course = '$journal->course' AND s.userid = u.id)
|
||||
OR (t.course = '$journal->course' AND t.userid = u.id))
|
||||
AND u.id = j.userid
|
||||
AND j.journal = '$journal->id'
|
||||
ORDER BY j.modified DESC");
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ function journal_log_info($log) {
|
|||
{$CFG->prefix}user u
|
||||
WHERE e.id = '$log->info'
|
||||
AND e.journal = j.id
|
||||
AND e.user = u.id");
|
||||
AND e.userid = u.id");
|
||||
}
|
||||
|
||||
// OTHER JOURNAL FUNCTIONS ///////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
// make some easy ways to access the entries.
|
||||
if ( $eee = get_records("journal_entries", "journal", $journal->id)) {
|
||||
foreach ($eee as $ee) {
|
||||
$entrybyuser[$ee->user] = $ee;
|
||||
$entrybyuser[$ee->userid] = $ee;
|
||||
$entrybyentry[$ee->id] = $ee;
|
||||
}
|
||||
|
||||
|
@ -67,14 +67,14 @@
|
|||
$newentry->mailed = 0; // Make sure mail goes out (again, even)
|
||||
$newentry->id = $num;
|
||||
if (! update_record("journal_entries", $newentry)) {
|
||||
notify("Failed to update the journal feedback for user $entry->user");
|
||||
notify("Failed to update the journal feedback for user $entry->userid");
|
||||
} else {
|
||||
$count++;
|
||||
}
|
||||
$entrybyuser[$entry->user]->rating = $vals[r];
|
||||
$entrybyuser[$entry->user]->comment = $vals[c];
|
||||
$entrybyuser[$entry->user]->teacher = $USER->id;
|
||||
$entrybyuser[$entry->user]->timemarked = $timenow;
|
||||
$entrybyuser[$entry->userid]->rating = $vals[r];
|
||||
$entrybyuser[$entry->userid]->comment = $vals[c];
|
||||
$entrybyuser[$entry->userid]->teacher = $USER->id;
|
||||
$entrybyuser[$entry->userid]->timemarked = $timenow;
|
||||
}
|
||||
}
|
||||
add_to_log($course->id, "journal", "update feedback", "report.php?id=$cm->id", "$count users");
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2002101200;
|
||||
$module->version = 2002122300;
|
||||
$module->cron = 60;
|
||||
|
||||
?>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
}
|
||||
|
||||
|
||||
if ($entry = get_record("journal_entries", "user", $USER->id, "journal", $journal->id)) {
|
||||
if ($entry = get_record("journal_entries", "userid", $USER->id, "journal", $journal->id)) {
|
||||
|
||||
if (empty($entry->text)) {
|
||||
echo "<P ALIGN=center><B>".get_string("blankentry","journal")."</B></P>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue