From ec5c4ebf6bd1a6787ac7123f7e0b2dc450cce843 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Jan 2017 11:20:56 +0100 Subject: [PATCH] FIX timeout during export (can be solved only if safe_mode is off) --- htdocs/exports/export.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 7b51aa02f15..604af215581 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -244,6 +244,13 @@ if ($step == 1 || $action == 'cleanselect') if ($action == 'builddoc') { + $max_execution_time_for_export = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME)?300:$conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_export) + { + @ini_set("max_execution_time", $max_execution_time_for_export); // This work only if safe mode is off. also web servers has timeout of 300 + } + // Build export file $result=$objexport->build_file($user, GETPOST('model','alpha'), $datatoexport, $array_selected, $array_filtervalue); if ($result < 0)