Skip to content

Commit

Permalink
MDL-45483 mod_forum: corrects values for maxattachments in forum sett…
Browse files Browse the repository at this point in the history
…ings
  • Loading branch information
kwiliarty committed May 9, 2014
1 parent 8c80b45 commit 7a98bba
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
18 changes: 18 additions & 0 deletions mod/forum/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
17 changes: 16 additions & 1 deletion mod/forum/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,22 @@ function definition() {
$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);
Expand Down
2 changes: 1 addition & 1 deletion mod/forum/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 7a98bba

Please sign in to comment.