MDL-45483 mod_forum: corrects values for maxattachments in forum settings

This commit is contained in:
Kevin Wiliarty 2014-05-08 12:37:13 -04:00
parent 8c80b452dc
commit 7a98bbab51
3 changed files with 35 additions and 2 deletions

View File

@ -136,5 +136,23 @@ function xmldb_forum_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2014040400, 'forum');
}
if ($oldversion < 2014051201) {
// Incorrect values that need to be replaced.
$replacements = array(
11 => 20,
12 => 50,
13 => 100
);
// Run the replacements.
foreach ($replacements as $old => $new) {
$DB->set_field('forum', 'maxattachments', $new, array('maxattachments' => $old));
}
// Forum savepoint reached.
upgrade_mod_savepoint(true, 2014051201, 'forum');
}
return true;
}

View File

@ -63,7 +63,22 @@ class mod_forum_mod_form extends moodleform_mod {
$mform->addHelpButton('maxbytes', 'maxattachmentsize', 'forum');
$mform->setDefault('maxbytes', $CFG->forum_maxbytes);
$choices = array(0,1,2,3,4,5,6,7,8,9,10,20,50,100);
$choices = array(
0 => 0,
1 => 1,
2 => 2,
3 => 3,
4 => 4,
5 => 5,
6 => 6,
7 => 7,
8 => 8,
9 => 9,
10 => 10,
20 => 20,
50 => 50,
100 => 100
);
$mform->addElement('select', 'maxattachments', get_string('maxattachments', 'forum'), $choices);
$mform->addHelpButton('maxattachments', 'maxattachments', 'forum');
$mform->setDefault('maxattachments', $CFG->forum_maxattachments);

View File

@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014051200; // The current module version (Date: YYYYMMDDXX)
$plugin->version = 2014051201; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2014050800; // Requires this Moodle version
$plugin->component = 'mod_forum'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 60;