From 85eda328a46085d1de434a87d05cc69e7f5d6e21 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Tue, 10 Feb 2015 13:17:04 +0100 Subject: [PATCH] Fixed problems with export data when type equals csv, export less data Tiquet: #1756 (cherry picked from commit a6807034eb737a5e2de2cb4f2fbdad2f7677d54e) --- .../operation/agentes/exportdata.csv.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/agentes/exportdata.csv.php b/pandora_console/operation/agentes/exportdata.csv.php index f903dc7899..7357da843f 100644 --- a/pandora_console/operation/agentes/exportdata.csv.php +++ b/pandora_console/operation/agentes/exportdata.csv.php @@ -112,7 +112,7 @@ if (!empty ($module)) { $work_end = $end - $period + $work_period; //Buffer to get data, anyway this will report a memory exhaustin - + $flag_last_time_slice = false; while ($work_end <= $end) { $data = array (); // Reinitialize array for each module chunk @@ -154,7 +154,18 @@ if (!empty ($module)) { $output = ""; unset($data); unset($data_single); - $work_end = $work_end + $work_period; + if ($flag_last_time_slice) + break; + + if (($work_end + $work_period) > $end) { + // Get the last timelapse + $work_period = $end - $work_end; + $work_end = $end; + $flag_last_time_slice = true; + } + else { + $work_end = $work_end + $work_period; + } } unset ($output); $output = "";