Skip to content

Commit b68b255

Browse files
authored
Merge pull request #171 from andrewnicols/increaseDefaultUploads
Increase max upload size
2 parents 848c098 + c89c28e commit b68b255

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

.github/workflows/test_buildx_and_publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
-e PHP_INI-apc.enabled=0 \
3232
-e PHP_INI-apc.enable_cli=0 \
3333
-e PHP_INI-pcov.enabled=1 \
34+
-e PHP_INI-upload_max_filesize=20M \
3435
moodle-php-apache
3536
docker exec test0 php /var/www/html/test.php
3637
docker exec test0 php /var/www/html/check-ini.php

root/usr/local/bin/moodle-docker-php-ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44

55
echo "Checking for php configuration in environment"
66

7-
localinifile="/usr/local/etc/php/conf.d/10-local.ini"
7+
localinifile="/usr/local/etc/php/conf.d/20-local.ini"
88

99
cat <<'EOF' > $localinifile
1010
; --

root/usr/local/etc/php/conf.d/10-docker-php-moodle.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@
44
; See MDL-71390 for more info. This is the recommended / required
55
; value to support sites having 1000 courses, activities, users....
66
max_input_vars = 5000
7+
8+
; Increase the maximum filesize to 200M, which is a more realistic figure.
9+
upload_max_filesize = 200M
10+
11+
; Increase the maximum post size to accomodate the increased upload_max_filesize.
12+
; The default value is 6MB more than the default upload_max_filesize.
13+
post_max_size = 206M

tests/fixtures/check-ini.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?php
22

3-
$fileuploads = ini_get('file_uploads');
4-
$apcenabled = ini_get('apc.enabled');
5-
$memorylimit = ini_get('memory_limit');
63

74
$allokay = true;
85
$message = [];
6+
7+
$fileuploads = ini_get('file_uploads');
98
if (!empty($fileuploads)) {
109
$allokay = false;
1110
$message[] = "Uploads are enabled and should be disabled.";
1211
$message[] = var_export($fileuploads, true);
1312
}
1413

14+
$apcenabled = ini_get('apc.enabled');
1515
if (!empty($apcenabled)) {
1616
$allokay = false;
1717
$message[] = "apc.enabled is not Off (0): ({$apcenabled})";
@@ -23,6 +23,7 @@
2323
$message[] = "apc.enabled_cli is not Off (0): ({$apcenabledcli})";
2424
}
2525

26+
$memorylimit = ini_get('memory_limit');
2627
if ($memorylimit !== '256M') {
2728
$allokay = false;
2829
$message[] = "Memory limit not set to 256M: ({$memorylimit})";
@@ -34,6 +35,18 @@
3435
$message[] = "pcov.enabled is not On (1): ({$pcovenabled})";
3536
}
3637

38+
$maxuploadsize = ini_get('upload_max_filesize');
39+
if ($maxuploadsize !== '20M') {
40+
$allokay = false;
41+
$message[] = "Maximum upload size not set to 20M: ({$maxuploadsize})";
42+
}
43+
44+
$postmaxsize = ini_get('post_max_size');
45+
if ($postmaxsize !== '206M') {
46+
$allokay = false;
47+
$message[] = "Maximum post size not set to 206M: ({$postmaxsize})";
48+
}
49+
3750
if (php_sapi_name() === 'cli') {
3851
if ($allokay) {
3952
echo "OK\n";

0 commit comments

Comments
 (0)