From 80b6c1626b57989d5f5da927b7f0c5ede6bcb827 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 7 Apr 2015 16:02:26 +0200 Subject: [PATCH] --- phork0.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 phork0.txt diff --git a/phork0.txt b/phork0.txt new file mode 100644 index 0000000..e9854ce --- /dev/null +++ b/phork0.txt @@ -0,0 +1,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 \ No newline at end of file -- 2.30.2