Skip to content

Commit 6fd2af7

Browse files
committed
Merge tag '2.0.3'
Hotfix release - Hotfix bottle neck #1153 ToolboxFile.php - Hotfix bottle neck 2 #1153 MetaModels.php
2 parents 4b9da91 + 79a1548 commit 6fd2af7

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/MetaModels/Helper/ToolboxFile.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,10 @@ private function checkDownloads()
699699
*/
700700
public static function convertValueToPath($varValue)
701701
{
702+
if (empty($varValue)) {
703+
return '';
704+
}
705+
702706
$objFiles = FilesModel::findByPk($varValue);
703707

704708
if ($objFiles !== null) {

src/MetaModels/MetaModel.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* @author Chris Raidler <c.raidler@rad-consulting.ch>
2222
* @author David Molineus <david.molineus@netzmacht.de>
2323
* @author Sven Baumann <baumann.sv@gmail.com>
24+
* @author Ingolf Steinhardt <info@e-spin.de>
2425
* @copyright 2012-2018 The MetaModels team.
2526
* @license https://github.com/MetaModels/core/blob/master/LICENSE LGPL-3.0-or-later
2627
* @filesource
@@ -76,6 +77,13 @@ class MetaModel implements IMetaModel
7677
*/
7778
protected $serviceContainer;
7879

80+
/**
81+
* The cache existing ids.
82+
*
83+
* @var array
84+
*/
85+
private $existingIds = [];
86+
7987
/**
8088
* Instantiate a MetaModel.
8189
*
@@ -722,6 +730,11 @@ public function getIdsFromFilter($objFilter, $strSortBy = '', $intOffset = 0, $i
722730
} elseif ('id' === $strSortBy) {
723731
asort($arrFilteredIds);
724732
} elseif (in_array($strSortBy, array('pid', 'tstamp', 'sorting'))) {
733+
// Check existing ids.
734+
if (array_intersect($arrFilteredIds, $this->existingIds) == $arrFilteredIds) {
735+
return $arrFilteredIds;
736+
}
737+
725738
// Sort by database values.
726739
$arrFilteredIds = $this
727740
->getDatabase()
@@ -736,6 +749,8 @@ public function getIdsFromFilter($objFilter, $strSortBy = '', $intOffset = 0, $i
736749
)
737750
->execute($arrFilteredIds)
738751
->fetchEach('id');
752+
753+
$this->existingIds = array_merge($this->existingIds, $arrFilteredIds);
739754
} elseif ($strSortBy == 'random') {
740755
shuffle($arrFilteredIds);
741756
}

0 commit comments

Comments
 (0)