[TASK] Calculated hash of File object is never used 89/26689/5
authorSteffen Ritter <info@rs-websystems.de>
Wed, 8 Jan 2014 08:51:28 +0000 (09:51 +0100)
committerBenjamin Mack <benni@typo3.org>
Mon, 13 Jan 2014 17:49:12 +0000 (18:49 +0100)
The indexing pre-calculates the file hash and stores it in
the sys_file table. Sadly the getter of file objects never looks
at this again and always recalculates the hash via the driver,
which is very slow.

Resolves: #54235
Releases: 6.2, 6.1, 6.0
Change-Id: I16bfa2126031f26b8e31da8d8c0b3fc07d0217dc
Reviewed-on: https://review.typo3.org/26689
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
Reviewed-by: Oliver Klee
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack
typo3/sysext/core/Classes/Resource/File.php

index d3832ac..9d99675 100644 (file)
@@ -151,6 +151,18 @@ class File extends AbstractFile {
        }
 
        /**
+        * Gets SHA1 hash.
+        *
+        * @return string
+        */
+       public function getSha1() {
+               if (empty($this->properties['sha1'])) {
+                       $this->properties['sha1'] = parent::getSha1();
+               }
+               return $this->properties['sha1'];
+       }
+
+       /**
         * Replace the current file contents with the given string
         *
         * @param string $contents The contents to write to the file.