]> git.p6c8.net - jirafeau.git/blobdiff - lib/functions.php
[BUGFIX] Manage PHP configuration with "unlimited" upload
[jirafeau.git] / lib / functions.php
index 536bfe1bcd0d423b80a215d07fb7210ea218d178..cfc7dce8250f58c1debeec5e23477d97dca71c74 100644 (file)
@@ -235,13 +235,23 @@ function jirafeau_get_max_upload_size()
  */
 function jirafeau_get_max_upload_chunk_size_bytes($max_upload_chunk_size_bytes = 0)
 {
-    if ($max_upload_chunk_size_bytes > 0) {
-        return min(
-            jirafeau_get_max_upload_size_bytes(),
-            $max_upload_chunk_size_bytes
-        );
+    if ($max_upload_chunk_size_bytes == 0) {
+        $size = jirafeau_get_max_upload_size_bytes();
+        // Jirafeau must choose an arbitrary number as PHP config does not give any limit nor $max_upload_chunk_size_bytes
+        if ($size == 0) {
+            return 10000000; // 10MB
+        }
+        return $size;
     }
-    return jirafeau_get_max_upload_size_bytes();
+
+    $size = min(
+        jirafeau_get_max_upload_size_bytes(),
+        $max_upload_chunk_size_bytes
+    );
+    if ($size == 0) {
+        return $max_upload_chunk_size_bytes;
+    }
+    return $size;
 }
 
 /**

patrick-canterino.de