MDL-39077 max_files does not include current option when it is non-standard

Non-standard means php.ini was set to something not in the default list (like 7MB),
then the config was saved to that specific value, and now the value in php.ini has been changed
again so 7MB does not appear in the list.
This commit is contained in:
Damyon Wiese 2013-05-01 14:58:31 +08:00 committed by Dan Poltawski
parent 5f5843f84b
commit 367b977d4d
9 changed files with 11 additions and 10 deletions

View File

@ -23,9 +23,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
new lang_string('configprofileroles', 'admin'),
array('student', 'teacher', 'editingteacher')));
$max_upload_choices = get_max_upload_sizes();
$max_upload_choices = get_max_upload_sizes(0, 0, 0, $CFG->maxbytes);
// maxbytes set to 0 will allow the maximum server limit for uploads
$max_upload_choices[0] = new lang_string('serverlimit', 'admin');
$temp->add(new admin_setting_configselect('maxbytes', new lang_string('maxbytes', 'admin'), new lang_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
// 100MB
$defaultuserquota = 104857600;

View File

@ -33,10 +33,11 @@ if (isset($CFG->maxbytes)) {
$name = new lang_string('maximumsubmissionsize', 'assignsubmission_file');
$description = new lang_string('configmaxbytes', 'assignsubmission_file');
$config = get_config('assignsubmission_file');
$element = new admin_setting_configselect('assignsubmission_file/maxbytes',
$name,
$description,
1048576,
get_max_upload_sizes($CFG->maxbytes));
get_max_upload_sizes($CFG->maxbytes, 0, 0, $config->maxbytes));
$settings->add($element);
}

View File

@ -7,7 +7,7 @@ if ($ADMIN->fulltree) {
if (isset($CFG->maxbytes)) {
$settings->add(new admin_setting_configselect('assignment_maxbytes', get_string('maximumsize', 'assignment'),
get_string('configmaxbytes', 'assignment'), 1048576, get_max_upload_sizes($CFG->maxbytes)));
get_string('configmaxbytes', 'assignment'), 1048576, get_max_upload_sizes($CFG->maxbytes, 0, 0, $CFG->assignment_maxbytes)));
}
$options = array(ASSIGNMENT_COUNT_WORDS => trim(get_string('numwords', '', '?')),

View File

@ -13,7 +13,7 @@
<td class="c1">
<?php
$course = $DB->get_record('course', array('id'=>$this->data->course));
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes, 0, $this->field->param3);
echo html_writer::select($choices, 'param3', $this->field->param3, false, array('id' => 'param3'));
?>
</td>

View File

@ -45,7 +45,7 @@
<td class="c1">
<?php
$course = $DB->get_record('course', array('id'=>$this->data->course));
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes, 0, $this->field->param3);
echo html_writer::select($choices, 'param3', $this->field->param3, false, array('id'=>'param3'));
?>
</td>

View File

@ -57,7 +57,7 @@ class mod_forum_mod_form extends moodleform_mod {
// Attachments and word count.
$mform->addElement('header', 'attachmentswordcounthdr', get_string('attachmentswordcount', 'forum'));
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes);
$choices = get_max_upload_sizes($CFG->maxbytes, $COURSE->maxbytes, 0, $CFG->forum_maxbytes);
$choices[1] = get_string('uploadnotallowed');
$mform->addElement('select', 'maxbytes', get_string('maxattachmentsize', 'forum'), $choices);
$mform->addHelpButton('maxbytes', 'maxattachmentsize', 'forum');

View File

@ -46,7 +46,7 @@ if ($ADMIN->fulltree) {
if (isset($CFG->maxbytes)) {
$settings->add(new admin_setting_configselect('forum_maxbytes', get_string('maxattachmentsize', 'forum'),
get_string('configmaxbytes', 'forum'), 512000, get_max_upload_sizes($CFG->maxbytes)));
get_string('configmaxbytes', 'forum'), 512000, get_max_upload_sizes($CFG->maxbytes, 0, 0, $CFG->forum_maxbytes)));
}
// Default number of attachments allowed per post in all forums

View File

@ -129,7 +129,7 @@ class mod_workshop_mod_form extends moodleform_mod {
$mform->addElement('select', 'nattachments', $label, $options);
$mform->setDefault('nattachments', 1);
$options = get_max_upload_sizes($CFG->maxbytes, $this->course->maxbytes);
$options = get_max_upload_sizes($CFG->maxbytes, $this->course->maxbytes, 0, $workshopconfig->maxbytes);
$mform->addElement('select', 'maxbytes', get_string('maxbytes', 'workshop'), $options);
$mform->setDefault('maxbytes', $workshopconfig->maxbytes);

View File

@ -47,7 +47,8 @@ if ($ADMIN->fulltree) {
get_string('configgradedecimals', 'workshop'), 0, $options));
if (isset($CFG->maxbytes)) {
$options = get_max_upload_sizes($CFG->maxbytes);
$config = get_config('workshop');
$options = get_max_upload_sizes($CFG->maxbytes, 0, 0, $config->maxbytes);
$settings->add(new admin_setting_configselect('workshop/maxbytes', get_string('maxbytes', 'workshop'),
get_string('configmaxbytes', 'workshop'), 0, $options));
}