mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +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
|
@ -88,6 +88,9 @@ function assignment_upgrade($oldversion) {
|
|||
if ($oldversion < 2002111500) {
|
||||
execute_sql(" ALTER TABLE `assignment` ADD `resubmit` TINYINT(2) UNSIGNED DEFAULT '0' NOT NULL AFTER `format` ");
|
||||
}
|
||||
if ($oldversion < 2002122300) {
|
||||
execute_sql("ALTER TABLE `assignment_submissions` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ CREATE TABLE `prefix_assignment` (
|
|||
CREATE TABLE `prefix_assignment_submissions` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`assignment` int(10) unsigned NOT NULL default '0',
|
||||
`user` int(10) unsigned NOT NULL default '0',
|
||||
`userid` int(10) unsigned NOT NULL default '0',
|
||||
`timecreated` int(10) unsigned NOT NULL default '0',
|
||||
`timemodified` int(10) unsigned NOT NULL default '0',
|
||||
`numfiles` int(10) unsigned NOT NULL default '0',
|
||||
|
|
|
@ -23,7 +23,7 @@ CREATE TABLE assignment (
|
|||
CREATE TABLE assignment_submissions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
assignment integer NOT NULL default '0',
|
||||
"user" integer NOT NULL default '0',
|
||||
userid integer NOT NULL default '0',
|
||||
timecreated integer NOT NULL default '0',
|
||||
timemodified integer NOT NULL default '0',
|
||||
numfiles integer NOT NULL default '0',
|
||||
|
|
|
@ -119,8 +119,8 @@ function assignment_cron () {
|
|||
|
||||
echo "Processing assignment submission $submission->id\n";
|
||||
|
||||
if (! $user = get_record("user", "id", "$submission->user")) {
|
||||
echo "Could not find user $post->user\n";
|
||||
if (! $user = get_record("user", "id", "$submission->userid")) {
|
||||
echo "Could not find user $post->userid\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ function assignment_grades($assignmentid) {
|
|||
/// Must return an array of grades, indexed by user, and a max grade.
|
||||
|
||||
$return->grades = get_records_menu("assignment_submissions", "assignment",
|
||||
$assignmentid, "", "user,grade");
|
||||
$assignmentid, "", "userid,grade");
|
||||
$return->maxgrade = get_field("assignment", "grade", "id", "$assignmentid");
|
||||
return $return;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ function assignment_log_info($log) {
|
|||
FROM {$CFG->prefix}assignment a,
|
||||
{$CFG->prefix}user u
|
||||
WHERE a.id = '$log->info'
|
||||
AND u.id = '$log->user'");
|
||||
AND u.id = '$log->userid'");
|
||||
}
|
||||
|
||||
function assignment_get_all_submissions($assignment) {
|
||||
|
@ -237,7 +237,7 @@ function assignment_get_all_submissions($assignment) {
|
|||
return get_records_sql("SELECT a.*
|
||||
FROM {$CFG->prefix}assignment_submissions a,
|
||||
{$CFG->prefix}user_students s
|
||||
WHERE a.user = s.user
|
||||
WHERE a.userid = s.userid
|
||||
AND s.course = '$assignment->course'
|
||||
AND a.assignment = '$assignment->id'
|
||||
ORDER BY a.timemodified DESC");
|
||||
|
@ -251,8 +251,8 @@ function assignment_get_users_done($assignment) {
|
|||
{$CFG->prefix}user_students s,
|
||||
{$CFG->prefix}assignment_submissions a
|
||||
WHERE s.course = '$assignment->course'
|
||||
AND s.user = u.id
|
||||
AND u.id = a.user
|
||||
AND s.userid = u.id
|
||||
AND u.id = a.userid
|
||||
AND a.assignment = '$assignment->id'
|
||||
ORDER BY a.timemodified DESC");
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ function assignment_file_area($assignment, $user) {
|
|||
}
|
||||
|
||||
function assignment_get_submission($assignment, $user) {
|
||||
return get_record("assignment_submissions", "assignment", $assignment->id, "user", $user->id);
|
||||
return get_record("assignment_submissions", "assignment", $assignment->id, "userid", $user->id);
|
||||
}
|
||||
|
||||
function assignment_print_difference($time) {
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
/// Make some easy ways to reference submissions
|
||||
if ($submissions = assignment_get_all_submissions($assignment)) {
|
||||
foreach ($submissions as $submission) {
|
||||
$submissionbyuser[$submission->user] = $submission;
|
||||
$submissionbyuser[$submission->userid] = $submission;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
foreach($users as $user) {
|
||||
if (!isset($submissionbyuser[$user->id])) { // Need to create empty entry
|
||||
$newsubmission->assignment = $assignment->id;
|
||||
$newsubmission->user = $user->id;
|
||||
$newsubmission->userid = $user->id;
|
||||
$newsubmission->timecreated = time();
|
||||
if (!insert_record("assignment_submissions", $newsubmission)) {
|
||||
error("Could not insert a new empty submission");
|
||||
|
@ -97,7 +97,7 @@
|
|||
$newsubmission->mailed = 0; // Make sure mail goes out (again, even)
|
||||
$newsubmission->id = $num;
|
||||
if (! update_record("assignment_submissions", $newsubmission)) {
|
||||
notify(get_string("failedupdatefeedback", "assignment", $submission->user));
|
||||
notify(get_string("failedupdatefeedback", "assignment", $submission->userid));
|
||||
} else {
|
||||
$count++;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@
|
|||
echo "<FORM ACTION=submissions.php METHOD=post>\n";
|
||||
|
||||
foreach ($submissions as $submission) {
|
||||
$user = $users[$submission->user];
|
||||
$user = $users[$submission->userid];
|
||||
assignment_print_submission($assignment, $user, $submission, $teachers, $grades);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
}
|
||||
} else {
|
||||
$newsubmission->assignment = $assignment->id;
|
||||
$newsubmission->user = $USER->id;
|
||||
$newsubmission->userid = $USER->id;
|
||||
$newsubmission->timecreated = time();
|
||||
$newsubmission->timemodified = time();
|
||||
$newsubmission->numfiles = 1;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2002111500;
|
||||
$module->version = 2002122300;
|
||||
$module->cron = 60;
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue