[BUGFIX] IndexerService does not set creating user 96/19696/2
authorSteffen Ritter <info@rs-websystems.de>
Sat, 23 Mar 2013 14:11:11 +0000 (15:11 +0100)
committerBenjamin Mack <benni@typo3.org>
Sun, 7 Apr 2013 07:56:08 +0000 (09:56 +0200)
When a backenduser uploads a file an index record is
created. The sys_file table ships with the column cruser_id
 which is never been filled because all sys_file records
are created by the IndexerService which does not take care
of that field.

Add this knowledge to the indexer service.

Releases: 6.0, 6.1
Fixes: #46596
Change-Id: I2a82ea5375b892604fc1a27376487bc4efe3a16e
Reviewed-on: https://review.typo3.org/19696
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack
typo3/sysext/core/Classes/Resource/Service/IndexerService.php

index 57027b9..2b4302a 100644 (file)
@@ -122,10 +122,15 @@ class IndexerService implements \TYPO3\CMS\Core\SingletonInterface {
                        if ($movedFile === FALSE) {
                                // Crdate and tstamp should not be present when updating
                                // the file object, as they only relate to the index record
-                               $indexRecord = array_merge($fileInfo, array(
+                               $additionalInfo = array(
                                        'crdate' => $GLOBALS['EXEC_TIME'],
                                        'tstamp' => $GLOBALS['EXEC_TIME']
-                               ));
+                               );
+                               if (TYPO3_MODE === 'BE') {
+                                       $additionalInfo['cruser_id'] = intval($GLOBALS['BE_USER']->user['uid']);
+                               }
+                               $indexRecord = array_merge($fileInfo, $additionalInfo);
+
                                $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file', $indexRecord);
                                $fileInfo['uid'] = $GLOBALS['TYPO3_DB']->sql_insert_id();
                        }