]> git.p6c8.net - jirafeau_project.git/blobdiff - lib/functions.php
[BUGFIX] Manage PHP configuration with "unlimited" upload
[jirafeau_project.git] / lib / functions.php
index 95a5595ce4a647a9e7ee6bb42cca981176ff0800..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;
 }
 
 /**
@@ -1562,5 +1572,5 @@ function jirafeau_add_ending_slash($path)
 
 function jirafeau_default_web_root()
 {
-    return $_SERVER['HTTP_HOST'] . str_replace(basename(__FILE__), '', $_SERVER['REQUEST_URI']);
+    return $_SERVER['HTTP_HOST'] . str_replace('install.php', '', $_SERVER['REQUEST_URI']);
 }

patrick-canterino.de