From 573737adfd936a7ba9fce09405ccfea12aec2185 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 23 Mar 2021 16:40:03 +0100 Subject: [PATCH] LSio::import/export: set timeout according to the number of objects --- src/includes/class/class.LSio.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/includes/class/class.LSio.php b/src/includes/class/class.LSio.php index e1cecb29..51521fa4 100644 --- a/src/includes/class/class.LSio.php +++ b/src/includes/class/class.LSio.php @@ -227,6 +227,10 @@ class LSio extends LSlog_staticLoggerClass { $objectsInError = array(); self :: log_trace("import(): objects data=".varDump($objectsData)); + // Reset & increase time limit: allow one seconds by object to handle, + // with a minimum of 30 seconds + set_time_limit((count($objectsData)>30?count($objectsData):30)); + // Browse inputed objects foreach($objectsData as $objData) { $globalErrors = array(); @@ -379,6 +383,10 @@ class LSio extends LSlog_staticLoggerClass { } self :: log_debug(count($objects)." object(s) found to export"); + // Reset & increase time limit: allow one seconds by object to handle, + // with a minimum of 30 seconds + set_time_limit((count($objects)>30?count($objects):30)); + // Export objects using LSioFormat object if (!$ioFormat -> exportObjects($objects, $stream)) { LSerror :: addErrorCode('LSio_07');