From a36820003670cf792d8a2fe40ea748cf82e73606 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 13 Nov 2021 01:45:38 +0100 Subject: [PATCH] Add MAIN_MEMORY_LIMIT_ARCHIVE_DATAROOT and MAIN_MEMORY_LIMIT_DUMP --- htdocs/admin/tools/export_files.php | 4 +++- htdocs/core/class/utils.class.php | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index e0fdb740782..ec2ad4a815a 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -98,7 +98,9 @@ if (!empty($ExecTimeLimit)) { @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 error_reporting($err); } -$MemoryLimit = 0; + +/* If value has been forced with a php_admin_value, this has no effect. Example of value: '512M' */ +$MemoryLimit = getDolGlobalString('MAIN_MEMORY_LIMIT_ARCHIVE_DATAROOT'); if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index d56fcddafa7..e7ab489c60d 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -358,10 +358,19 @@ class Utils dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_INFO); + + /* If value has been forced with a php_admin_value, this has no effect. Example of value: '512M' */ + $MemoryLimit = getDolGlobalString('MAIN_MEMORY_LIMIT_DUMP'); + if (!empty($MemoryLimit)) { + @ini_set('memory_limit', $MemoryLimit); + } + + // TODO Replace with executeCLI function if ($execmethod == 1) { $output_arr = array(); $retval = null; + exec($fullcommandclear, $output_arr, $retval); if ($retval != 0) {