~ubuntu-branches/ubuntu/breezy/moodle/breezy

« back to all changes in this revision

Viewing changes to mod/assignment/db/postgres7.php

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2005-10-13 02:00:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051013020059-y2qcyo41t7nqppcg
Tags: 1.5.2-1ubuntu1
* Resync with debian (security update)
* changed dependencys to php5
* changed apache dependency to apache2 
* References
  CAN-2005-2247

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP // $Id: postgres7.php,v 1.7.10.2 2004/11/18 18:58:00 stronk7 Exp $
 
1
<?php // $Id: postgres7.php,v 1.18.2.1 2005/05/31 23:02:44 moodler Exp $
2
2
 
3
3
function assignment_upgrade($oldversion) {
4
4
// This function does anything necessary to upgrade
97
97
        assignment_refresh_events();
98
98
    }
99
99
 
100
 
    if ($oldversion < 2004060401) { 
 
100
    if ($oldversion < 2004111200) { 
 
101
        execute_sql("DROP INDEX {$CFG->prefix}assignment_course_idx;",false);
 
102
        execute_sql("DROP INDEX {$CFG->prefix}assignment_submissions_assignment_idx;",false); 
 
103
        execute_sql("DROP INDEX {$CFG->prefix}assignment_submissions_userid_idx;",false); 
 
104
        execute_sql("DROP INDEX {$CFG->prefix}assignment_submissions_mailed_idx;",false);
 
105
        execute_sql("DROP INDEX {$CFG->prefix}assignment_submissions_timemarked_idx;",false);
 
106
 
101
107
        modify_database('','CREATE INDEX prefix_assignment_course_idx ON prefix_assignment (course);');
102
108
        modify_database('','CREATE INDEX prefix_assignment_submissions_assignment_idx ON prefix_assignment_submissions (assignment);');
103
109
        modify_database('','CREATE INDEX prefix_assignment_submissions_userid_idx ON prefix_assignment_submissions (userid);');
105
111
        modify_database('','CREATE INDEX prefix_assignment_submissions_timemarked_idx ON prefix_assignment_submissions (timemarked);');
106
112
    }
107
113
 
 
114
    if ($oldversion < 2005010500) { 
 
115
        table_column('assignment', '', 'emailteachers', 'integer', '2', 'unsigned', 0, 'not null', 'resubmit');
 
116
    }
 
117
 
 
118
    if ($oldversion < 2005041100) { // replace wiki-like with markdown
 
119
        include_once( "$CFG->dirroot/lib/wiki_to_markdown.php" );
 
120
        $wtm = new WikiToMarkdown();
 
121
        $wtm->update( 'assignment','description','format' );
 
122
    }
 
123
 
 
124
    if ($oldversion < 2005041400) {  // Add new fields for the new refactored version of assignment
 
125
        table_column('assignment', '', 'timeavailable', 'integer', '10', 'unsigned', 0, 'not null', 'timedue');
 
126
        table_column('assignment', '', 'assignmenttype', 'varchar', '50', '', '', 'not null', 'format');
 
127
        execute_sql("UPDATE {$CFG->prefix}assignment SET assignmenttype = 'offline' WHERE type = '0';",false);
 
128
        execute_sql("UPDATE {$CFG->prefix}assignment SET assignmenttype = 'uploadsingle' WHERE type = '1';",false);
 
129
        execute_sql('ALTER TABLE '.$CFG->prefix.'assignment DROP type;');
 
130
    }
 
131
 
 
132
    if ($oldversion < 2005041501) {  // Add two new fields for general data handling, 
 
133
                                     // so most assignment types won't need new fields and backups stay simple
 
134
        table_column('assignment_submissions', '', 'data2', 'TEXT', '', '', '', 'not null', 'numfiles');
 
135
        table_column('assignment_submissions', '', 'data1', 'TEXT', '', '', '', 'not null', 'numfiles');
 
136
    }
 
137
 
 
138
    if ($oldversion < 2005041600) {  // Add five new fields for general assignment parameters
 
139
                                     // so most assignment types won't need new fields and backups stay simple
 
140
        table_column('assignment', '', 'var5', 'integer', '10', '', 0, 'null', 'emailteachers');
 
141
        table_column('assignment', '', 'var4', 'integer', '10', '', 0, 'null', 'emailteachers');
 
142
        table_column('assignment', '', 'var3', 'integer', '10', '', 0, 'null', 'emailteachers');
 
143
        table_column('assignment', '', 'var2', 'integer', '10', '', 0, 'null', 'emailteachers');
 
144
        table_column('assignment', '', 'var1', 'integer', '10', '', 0, 'null', 'emailteachers');
 
145
    }
 
146
 
 
147
    if ($oldversion < 2005041700) {  // Allow comments to have a formatting
 
148
        table_column('assignment_submissions', '', 'format', 'integer', '4', 'unsigned', '0', 'not null', 'comment');
 
149
    }
 
150
 
 
151
    if ($oldversion < 2005041800) {  // Prevent late submissions?  (default no)
 
152
        table_column('assignment', '', 'preventlate', 'integer', '2', 'unsigned', '0', 'not null', 'resubmit');
 
153
    }
 
154
 
 
155
    if ($oldversion < 2005060100) {
 
156
        include_once("$CFG->dirroot/mod/assignment/lib.php");
 
157
        assignment_refresh_events();
 
158
    }
 
159
 
 
160
 
 
161
/// These lines ALWAYS need to be here at the end of this file.  Don't mess with them. :-)
 
162
    include_once("$CFG->dirroot/mod/assignment/lib.php");
 
163
    assignment_upgrade_submodules();
 
164
 
108
165
    return true;
109
166
}
110
167