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'),
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
$temp->add(new admin_setting_configselect('maxbytes', new lang_string('maxbytes', 'admin'), new lang_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
// 100MB

View File

@ -33,11 +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');
$maxbytes = get_config('assignsubmission_file', 'maxbytes');
$element = new admin_setting_configselect('assignsubmission_file/maxbytes',
$name,
$description,
1048576,
get_max_upload_sizes($CFG->maxbytes, 0, 0, $config->maxbytes));
get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes));
$settings->add($element);
}

View File

@ -6,8 +6,12 @@ if ($ADMIN->fulltree) {
require_once($CFG->dirroot.'/mod/assignment/lib.php');
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'),
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', '', '?')),

View File

@ -45,8 +45,12 @@ if ($ADMIN->fulltree) {
get_string('configmanydiscussions', 'forum'), 100, PARAM_INT));
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'),
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

View File

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