2 namespace TYPO3\CMS\Core\Resource\Index;
64 if (!isset($identifier) || !is_string($identifier) || $identifier ===
'') {
65 throw new \InvalidArgumentException(
'Invalid file identifier given. It must be of type string and not empty. "' . gettype($identifier) .
'" given.', 1401732565);
94 $availableFiles = $this->storage->getFileIdentifiersInFolder($this->storage->getRootLevelFolder()->getIdentifier(),
true,
true);
107 $fileIndexRecords = $this->
getFileIndexRepository()->findInStorageWithIndexOutstanding($this->storage, $maximumFileCount);
108 foreach ($fileIndexRecords as $indexRecord) {
109 $fileObject = $this->
getResourceFactory()->getFileObject($indexRecord[
'uid'], $indexRecord);
121 $newMetaData = array(
125 if ($service->canProcess($fileObject)) {
126 $newMetaData[$service->getPriority()] = $service->extractMetaData($fileObject, $newMetaData);
131 foreach ($newMetaData as $data) {
132 $metaData = array_merge($metaData, $data);
146 if ($this->extractionServices === null) {
147 $this->extractionServices = $this->
getExtractorRegistry()->getExtractorsWithDriverSupport($this->storage->getDriverType());
160 $this->identifiedFileUids
163 foreach ($indexedNotExistentFiles as $record) {
164 if (!$this->storage->hasFile($record[
'identifier'])) {
178 foreach ($fileIdentifierArray as $fileIdentifier) {
180 if ($this->storage->isWithinProcessingFolder($fileIdentifier)) {
184 $modificationTime = $this->storage->getFileInfoByIdentifier($fileIdentifier, array(
'mtime'));
186 $indexRecord = $this->
getFileIndexRepository()->findOneByStorageUidAndIdentifier($this->storage->getUid(), $fileIdentifier);
188 if ($indexRecord !==
false) {
189 $this->identifiedFileUids[] = $indexRecord[
'uid'];
191 if ($indexRecord[
'modification_date'] !== $modificationTime[
'mtime'] || $indexRecord[
'missing']) {
192 $this->filesToUpdate[$fileIdentifier] = $indexRecord;
195 $this->filesToUpdate[$fileIdentifier] = null;
208 foreach ($this->filesToUpdate as $identifier => $data) {
211 $fileHash = $this->storage->hashFileByIdentifier($identifier,
'sha1');
214 if (!empty($files)) {
215 foreach ($files as $fileIndexEntry) {
217 if (!$this->storage->hasFile($fileIndexEntry[
'identifier'])) {
218 $fileObject = $this->
getResourceFactory()->getFileObject($fileIndexEntry[
'uid'], $fileIndexEntry);
219 $fileObject->updateProperties(array(
220 'identifier' => $identifier
223 $this->identifiedFileUids[] = $fileObject->getUid();
229 if ($fileObject === null) {
231 $this->identifiedFileUids[] = $fileObject->getUid();
255 'width' => $imageInfo->getWidth(),
256 'height' => $imageInfo->getHeight(),
277 $fileInfo = $this->storage->getFileInfoByIdentifier($identifier);
279 $fileInfo[
'type'] = $this->
getFileType($fileInfo[
'mime_type']);
280 $fileInfo[
'sha1'] = $this->storage->hashFileByIdentifier($identifier,
'sha1');
281 $fileInfo[
'extension'] = \TYPO3\CMS\Core\Utility\PathUtility::pathinfo($fileInfo[
'name'], PATHINFO_EXTENSION);
282 $fileInfo[
'missing'] = 0;
295 list($fileType) = explode(
'/', $mimeType);
296 switch (strtolower($fileType)) {
331 $mappingInfo = array(
335 'mtime' =>
'modification_date',
336 'ctime' =>
'creation_date',
337 'mimetype' =>
'mime_type'
339 $mappedFileInfo = array();
340 foreach ($fileInfo as $key => $value) {
341 if (array_key_exists($key, $mappingInfo)) {
342 if ($mappingInfo[$key] !== null) {
343 $mappedFileInfo[$mappingInfo[$key]] = $value;
346 $mappedFileInfo[$key] = $value;
349 return $mappedFileInfo;
380 return \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();