$strgrades = get_string('grades');
/// Calculate file name
- $downloadfilename = clean_filename("{$this->course->shortname} $strgrades.xml");
+ $shortname = format_string($this->course->shortname, true, array('context' => get_context_instance(CONTEXT_COURSE, $this->course->id)));
+ $downloadfilename = clean_filename("$shortname $strgrades.xml");
- make_upload_directory('temp/gradeexport');
- $tempfilename = $CFG->dataroot .'/temp/gradeexport/'. md5(sesskey().microtime().$downloadfilename);
+ make_temp_directory('gradeexport');
+ $tempfilename = $CFG->tempdir .'/gradeexport/'. md5(sesskey().microtime().$downloadfilename);
if (!$handle = fopen($tempfilename, 'w+b')) {
print_error('cannotcreatetempdir');
}
upgrade_main_savepoint(true, 2011083100.02);
}
- if ($oldversion < 2011090800) {
+ if ($oldversion < 2011090700.01) {
+ // Changing the default of field secret on table registration_hubs to NULL
+ $table = new xmldb_table('registration_hubs');
+ $field = new xmldb_field('secret', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'confirmed');
+
+ // Launch change of default for field secret
+ $dbman->change_field_default($table, $field);
+
+ // Main savepoint reached
+ upgrade_main_savepoint(true, 2011090700.01);
+ }
+
+ if ($oldversion < 2011091200.00) {
+ //preference not required since 2.0
+ $DB->delete_records('user_preferences', array('name'=>'message_showmessagewindow'));
+
+ //re-introducing emailstop. check that its turned off so people dont suddenly stop getting notifications
+ $DB->set_field('user', 'emailstop', 0, array('emailstop' => 1));
+
+ upgrade_main_savepoint(true, 2011091200.00);
+ }
+
++ if ($oldversion < 2011091300.00) {
+ // Increase the length of the of the course shortname field as it is now going
+ // to be consistently filtered and 100 characters is practically useless for
+ // things like the multilang filter.
+
+ $table = new xmldb_table('course');
+ $field = new xmldb_field('shortname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'fullname');
+ $index = new xmldb_index('shortname', XMLDB_INDEX_NOTUNIQUE, array('shortname'));
+
+ // First check the shortname field exists... pretty heavy mod if it doesnt!
+ if ($dbman->field_exists($table, $field)) {
+ // Conditionally launch drop index shortname, this is required to happen
+ // before we can edit the field.
+ if ($dbman->index_exists($table, $index)) {
+ $dbman->drop_index($table, $index);
+ }
+
+ // Launch change of precision for field shortname
+ $dbman->change_field_precision($table, $field);
+ // Add the index back to the table now that we're finished our mods
+ $dbman->add_index($table, $index);
+ }
+
+ // Main savepoint reached
- upgrade_main_savepoint(true, 2011090800);
++ upgrade_main_savepoint(true, 2011091300.00);
+ }
+
return true;
}