LSio::import/export: set timeout according to the number of objects

This commit is contained in:
Benjamin Renard 2021-03-23 16:40:03 +01:00
parent 0ffbf3274a
commit 573737adfd

View file

@ -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');