diff --git a/README.md b/README.md
index 5011ef30c..f90c4e30a 100644
--- a/README.md
+++ b/README.md
@@ -148,7 +148,7 @@ TODO
+ *Version*: 5.0.4-alpha3
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
-+ *Line count*: **871753**
++ *Line count*: **871857**
+ *Field count*: **2104**
+ *File count*: **6028**
+ *Folder count*: **633**
diff --git a/admin/README.txt b/admin/README.txt
index 5011ef30c..f90c4e30a 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -148,7 +148,7 @@ TODO
+ *Version*: 5.0.4-alpha3
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
-+ *Line count*: **871753**
++ *Line count*: **871857**
+ *Field count*: **2104**
+ *File count*: **6028**
+ *Folder count*: **633**
diff --git a/admin/tmpl/joomla_components/default_body.php b/admin/tmpl/joomla_components/default_body.php
index 38f3c3df3..cd15aef7f 100644
--- a/admin/tmpl/joomla_components/default_body.php
+++ b/admin/tmpl/joomla_components/default_body.php
@@ -167,10 +167,9 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
get($_button['view'].'.create')): ?>
-
+
-
-
+
@@ -182,7 +181,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
get($_button['view'].'.create')): ?>
-
+
@@ -196,7 +195,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
get($_button['view'].'.create')): ?>
-
+
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Spreadsheet/Importer.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Spreadsheet/Importer.php
index b68f0a80b..305bfc713 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Spreadsheet/Importer.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Spreadsheet/Importer.php
@@ -34,6 +34,7 @@ final class Importer
*
* @return \Generator A generator that yields each row as an array.
* @throws \InvalidArgumentException If the file does not exist.
+ * @throws \OutOfRangeException If the start row is beyond the highest row, no rows can be processed.
* @throws ReaderException If there is an error identifying or reading the file.
* @throws SpreadsheetException If there is an error working with the spreadsheet.
* @since 3.2.0
@@ -47,23 +48,43 @@ final class Importer
}
try {
+ // Identify file type and create reader
+ $inputFileType = IOFactory::identify($filePath);
+ $reader = IOFactory::createReader($inputFileType);
+ $reader->setReadDataOnly(true);
+
+ // Load the entire spreadsheet to determine the highest row
+ $spreadsheet = $reader->load($filePath);
+ $worksheet = $spreadsheet->getActiveSheet();
+ $highestRow = $worksheet->getHighestRow(); // Get the highest row number in the sheet
+
+ // Disconnect and free memory after fetching the highest row
+ $spreadsheet->disconnectWorksheets();
+ unset($spreadsheet);
+
+ // If the start row is beyond the highest row, no rows can be processed
+ if ($startRow > $highestRow)
+ {
+ throw new \OutOfRangeException("Start row ($startRow) is beyond highest row ($highestRow)");
+ }
+
// Initialize variables for row processing
$totalRows = $startRow;
do {
- // Set up a new chunk filter for the current chunk
- $chunkFilter = new ChunkReadFilter($totalRows, $chunkSize);
- $inputFileType = IOFactory::identify($filePath);
- $reader = IOFactory::createReader($inputFileType);
- $reader->setReadFilter($chunkFilter);
- $reader->setReadDataOnly(true);
+ // Calculate the last row in the current chunk
+ $endRow = min($totalRows + $chunkSize - 1, $highestRow);
- // Load the chunk into the spreadsheet
+ // Set up a new chunk filter for the current chunk
+ $chunkFilter = new ChunkReadFilter($totalRows, $endRow);
+ $reader->setReadFilter($chunkFilter);
+
+ // Reload the chunk into the spreadsheet
$spreadsheet = $reader->load($filePath);
$worksheet = $spreadsheet->getActiveSheet();
// Iterate through the rows in the current chunk
- foreach ($worksheet->getRowIterator($totalRows) as $row)
+ foreach ($worksheet->getRowIterator($totalRows, $endRow) as $row)
{
$rowIndex = $row->getRowIndex();
$rowData = [];
@@ -87,7 +108,7 @@ final class Importer
$spreadsheet->disconnectWorksheets();
unset($spreadsheet);
- } while (!empty($rowData)); // Continue reading until no more rows are available
+ } while ($totalRows <= $highestRow); // Continue reading while within the row limit
} catch (ReaderException $e) {
throw new ReaderException("Error reading the file: " . $e->getMessage(), $e->getCode(), $e);
|