Commit aa17e510 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add warning about post_max_size and upload_max_filesize (bug #634193)



Change-Id: I0ce9180f187e5f94b95b2d16afc9bc9c23fa2557
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent d4ef5221
......@@ -102,6 +102,19 @@ $tz_count = preg_match("/\+[0-9]{4}/", strftime("%z"));
if ($tz_count == 0 || $tz_count == FALSE) {
$warnings[] = get_string('timezoneidentifierunusable', 'error');
}
// Check file upload settings.
$postmax = ini_get('post_max_size');
$uploadmax = ini_get('upload_max_filesize');
$realpostmax = get_real_size($postmax);
$realuploadmax = get_real_size($uploadmax);
if ($realpostmax && $realpostmax < $realuploadmax) {
$warnings[] = get_string('postmaxlessthanuploadmax', 'error', $postmax, $uploadmax, $postmax);
}
else if ($realpostmax && $realpostmax < 9000000) {
$warnings[] = get_string('smallpostmaxsize', 'error', $postmax, $postmax);
}
$smarty->assign('warnings', $warnings);
$smarty->display('admin/index.tpl');
......
......@@ -120,4 +120,6 @@ $string['missingparamid'] = 'Missing id';
$string['themenameinvalid'] = "The name of the theme '%s' contains invalid characters.";
$string['timezoneidentifierunusable'] = 'PHP on your website host does not return a useful value for the timezone identifier (%%z) - certain date formatting, such as the LEAP2A export, will be broken.';
$string['postmaxlessthanuploadmax'] = 'Your PHP post_max_size setting (%s) is smaller than your upload_max_filesize setting (%s). Uploads larger than %s will fail without displaying an error. Usually, post_max_size should be much larger than upload_max_filesize.';
$string['smallpostmaxsize'] = 'Your PHP post_max_size setting (%s) is very small. Uploads larger than %s will fail without displaying an error.';
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment