[BUGFIX] Indexer does not update the FileObjects 90/27690/2
authorSteffen Ritter <info@rs-websystems.de>
Tue, 18 Feb 2014 13:18:08 +0000 (14:18 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 18 Feb 2014 18:51:01 +0000 (19:51 +0100)
If the Indexer updates metadata during runtimer (after a file object)
has been created, the file object itself is not updated.

This leads to possible errors with image rendering, if files are to be
shown which have not been indexed before.

Releases: 6.2
Resolves: #53772
Change-Id: I70be5ebefe1e00e903694a576847fa8fba167461
Reviewed-on: https://review.typo3.org/27690
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Classes/Resource/File.php
typo3/sysext/core/Classes/Resource/Index/Indexer.php

index 6e4c783..114b0d7 100644 (file)
@@ -251,6 +251,22 @@ class File extends AbstractFile {
        }
 
        /**
+        * Updates MetaData properties
+        *
+        * @internal Do not use outside the FileAbstraction Layer classes
+        *
+        * @param array $properties
+        * @return void
+        */
+       public function _updateMetaDataProperties(array $properties) {
+               if ($this->metaDataProperties !== NULL) {
+                       $this->metaDataProperties = array_merge($this->metaDataProperties, $properties);
+               } else {
+                       $this->metaDataProperties = $properties;
+               }
+       }
+
+       /**
         * Returns the names of all properties that have been updated in this record
         *
         * @return array
index a0d133d..898879f 100644 (file)
@@ -120,6 +120,7 @@ class Indexer {
                        foreach ($newMetaData as $data) {
                                $metaData = array_merge($metaData, $data);
                        }
+                       $fileObject->_updateMetaDataProperties($metaData);
                        $this->getMetaDataRepository()->update($fileObject->getUid(), $metaData);
                        $this->getFileIndexRepository()->updateIndexingTime($fileObject->getUid());
                }
@@ -220,6 +221,7 @@ class Indexer {
                        $metaData = array();
                        list($metaData['width'], $metaData['height']) = getimagesize($rawFileLocation);
                        $this->getMetaDataRepository()->update($fileObject->getUid(), $metaData);
+                       $fileObject->_updateMetaDataProperties($metaData);
                }
        }