Project

General

Profile

Actions

Bug #84110

closed

Files are deleted when a new record version is published

Added by Benedikt Huss about 6 years ago. Updated over 4 years ago.

Status:
Rejected
Priority:
Must have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2018-03-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Lets assume we have a custom domain element with a column that is defined like this:

'sample_file' => array(
  'exclude' => 0,
  'label' => 'Sample File',
  'config' => array(
    'type' => 'group',
    'internal_type' => 'file',
    'uploadfolder' => 'uploads/tx_myextension/sampeFiles',
    'show_thumbs' => 1,
    'size' => 1,
    'allowed' => 'gif,jpg,jpeg',
    'disallowed' => '',
    'maxitems' => 1
  ),
),

When a record is created, the file can be uploaded and is stored in the upload folder. Now let’s assume this record is edited in a workspace (any field can be changed, but the sample file is unchanged). After the changes have been made, the record is published to the live workspace.

Unfortunately, as soon as the record is published, the file is deleted from the upload folder. This happens when versions for the published records are deleted. The code is located in \TYPO3\CMS\Core\DataHandling\DataHandler. In the function deleteRecord all fields that holds references to files are fetched, after that, all files are deleted without any further check.

Before a file is deleted, there should be a check if the file is not referenced by another record. Only if no other reference can be found, the file should really be deleted.

Actions

Also available in: Atom PDF