1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /* @var $rf \TYPO3\CMS\Core\Resource\ResourceFactory */ $rf = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Core\\Resource\\ResourceFactory' ); /* @var $fir \TYPO3\CMS\Core\Resource\Index\FileIndexRepository */ $fir = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository' ); // we create a folder object without checking that the folder // actually exists, since we need it for the index only. list($storageUid, $folderId) = explode( ':', $this->settings['damDeckPlanFolderId'] ); $storage = $rf->getStorageObject($storageUid, array(), $folderId); $folder = $rf->createFolderObject($storage, $folderId, $folderId); $arFileRows = $fir->findByFolder($folder); if (count($arFileRows) > 0) { //we have files in our index - use them $arFiles = array(); foreach ($arFileRows as $arRow) { $arFiles[] = $rf->getFileObject($arRow['uid'], $arRow); } } else { //we do not have any files in the index of the folder // better fetch the files from DAM directly /* @var $folder \TYPO3\CMS\Core\Resource\Folder*/ $folder = $rf->retrieveFileOrFolderObject( $this->settings['damDeckPlanFolderId'] ); $arFiles = $folder->getFiles(); } // .. do something with the files |