MDL-39077 maxbytes - fix warnings for cli install

This commit is contained in:
Damyon Wiese 2013-05-02 12:10:05 +08:00
parent e7ff753cab
commit c9c01f75b1
5 changed files with 19 additions and 7 deletions

View file

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

View file

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

View file

@ -6,8 +6,12 @@ if ($ADMIN->fulltree) {
require_once($CFG->dirroot.'/mod/assignment/lib.php'); require_once($CFG->dirroot.'/mod/assignment/lib.php');
if (isset($CFG->maxbytes)) { if (isset($CFG->maxbytes)) {
$maxbytes = 0;
if (isset($CFG->assignment_maxbytes)) {
$maxbytes = $CFG->assignment_maxbytes;
}
$settings->add(new admin_setting_configselect('assignment_maxbytes', get_string('maximumsize', 'assignment'), $settings->add(new admin_setting_configselect('assignment_maxbytes', get_string('maximumsize', 'assignment'),
get_string('configmaxbytes', 'assignment'), 1048576, get_max_upload_sizes($CFG->maxbytes, 0, 0, $CFG->assignment_maxbytes))); get_string('configmaxbytes', 'assignment'), 1048576, get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes)));
} }
$options = array(ASSIGNMENT_COUNT_WORDS => trim(get_string('numwords', '', '?')), $options = array(ASSIGNMENT_COUNT_WORDS => trim(get_string('numwords', '', '?')),

View file

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

View file

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