[BUGFIX] Changing file title changes file name
authorAndreas Wolf <andreas.wolf@typo3.org>
Sat, 1 Sep 2012 16:20:39 +0000 (18:20 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Mon, 3 Sep 2012 11:02:49 +0000 (13:02 +0200)
The TCA configuration of sys_file allows direct editing of the file
name. As t3lib_TCEmain does not recognize this change as a
filesystem-related change on saving, the file is not renamed on disk.
Instead, the index record is changed, so the file is not recognized
anymore, leading to a reindexing. Because of this, all references to the
old record seem to break.

This commit makes the name field read-only and adds the title field
(which is not present in the TCA at all currently).

Change-Id: Ice110fa7ea0cc335f8b9fa8a57ecc9fe7527de76
Resolves: #39884
Resolves: #36795
Resolves: #39859
Releases: 6.0
Reviewed-on: http://review.typo3.org/14260
Reviewed-by: Mario Rimann
Tested-by: Mario Rimann
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
t3lib/stddb/tables.sql
t3lib/stddb/tca_sys_file.php
typo3/sysext/lang/locallang_tca.xlf

index 7b0164b..8c1c651 100644 (file)
@@ -301,6 +301,7 @@ CREATE TABLE sys_file (
        extension varchar(255) DEFAULT '' NOT NULL,
        mime_type varchar(255) DEFAULT '' NOT NULL,
        name tinytext,
+       title tinytext,
        sha1 tinytext,
        size int(11) DEFAULT '0' NOT NULL,
        creation_date int(11) DEFAULT '0' NOT NULL,
index 0209d12..19c3a58 100644 (file)
@@ -54,7 +54,17 @@ $TCA['sys_file'] = array(
                        'config' => array(
                                'type' => 'input',
                                'size' => '30',
-                               'eval' => 'required'
+                               'eval' => 'required',
+                               'readOnly' => TRUE
+                       )
+               ),
+               'title' => array(
+                       'exclude' => 1,
+                       'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_file.title',
+                       'config' => array(
+                               'type' => 'input',
+                               'size' => '30',
+                               'placeholder' => '__row|name'
                        )
                ),
                'description' => array(
@@ -125,7 +135,7 @@ $TCA['sys_file'] = array(
                )
        ),
        'types' => array(
-               '1' => array('showitem' => 'fileinfo, name, description, alternative, storage')
+               '1' => array('showitem' => 'fileinfo, name, title, description, alternative, storage')
        ),
        'palettes' => array()
 );
index 5641bbe..87d3f43 100644 (file)
                                <source>Identifier</source>
                        </trans-unit>
                        <trans-unit id="sys_file.name" xml:space="preserve">
+                               <source>Filename</source>
+                       </trans-unit>
+                       <trans-unit id="sys_file.title" xml:space="preserve">
                                <source>Title</source>
                        </trans-unit>
                        <trans-unit id="sys_file.type" xml:space="preserve">