Update on v4.0.4-alpha3 (changes towards the next release)

Here's an update on the current version, which includes changes towards the next release still in development.
This commit is contained in:
Robot 2024-10-14 00:22:30 +02:00
parent a91fc952a0
commit 36c9470104
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
4 changed files with 36 additions and 16 deletions

View File

@ -148,7 +148,7 @@ TODO
+ *Version*: 4.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*: **869301**
+ *Line count*: **869405**
+ *Field count*: **2098**
+ *File count*: **6007**
+ *Folder count*: **621**

View File

@ -148,7 +148,7 @@ TODO
+ *Version*: 4.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*: **869301**
+ *Line count*: **869405**
+ *Field count*: **2098**
+ *File count*: **6007**
+ *Folder count*: **621**

View File

@ -167,10 +167,9 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
<?php if ($canDo->get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&id=<?php echo $id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php elseif ($canDo->get($_button['view'].'.create')): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&field=joomla_component&field_id=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&ref=joomla_component&refid=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php endif; ?>
<?php endforeach; ?>
</div>
</td>
<td class="hidden-phone">
@ -182,7 +181,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
<?php if ($canDo->get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&id=<?php echo $id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php elseif ($canDo->get($_button['view'].'.create')): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&field=joomla_component&field_id=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&ref=joomla_component&refid=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php endif; ?>
<?php endforeach; ?>
</div>
@ -196,7 +195,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
<?php if ($canDo->get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&id=<?php echo $id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php elseif ($canDo->get($_button['view'].'.create')): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&field=joomla_component&field_id=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&ref=joomla_component&refid=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php endif; ?>
<?php endforeach; ?>
</div>

View File

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