Bug #48336

sys_file record doesn't get flagged as delete after deleting a file

Added by Frans Saris over 8 years ago. Updated about 8 years ago.

Status:
Rejected
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2013-05-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When you delete a file (in BE filelist module) the deleted field in sys_file record doesn't get updated to 1


Related issues

Related to TYPO3 Core - Feature #48182: File-Indexer doesn't flag missing files as deletedClosed2013-05-14

Actions
Related to TYPO3 Core - Bug #50363: Fatal error: Call to undefined method TYPO3\CMS\Core\Resource\ProcessedFile::getUpdatedProperties()Rejected2013-07-24

Actions
Related to TYPO3 Core - Bug #50508: Re-uploading file in backend failsClosed2013-07-29

Actions
Related to TYPO3 Core - Bug #50531: Deleted state is not persisted in file objectsClosed2013-07-29

Actions
Related to TYPO3 Core - Task #50876: Handling of deleted files in FALClosed2013-08-06

Actions
#1

Updated by Frans Saris over 8 years ago

Did just some debugging and found out that $fileObject->deleted is set to TRUE. But the change isn't persisted.

The following 2 changes fixes this.

In \TYPO3\CMS\Core\Resource\ResourceStorage::deleteFile() add:


        // Mark the file object as deleted
        $fileObject->setDeleted();
        $this->updateFile($fileObject);

and change \TYPO3\CMS\Core\Resource\ResourceStorage::updateFile() to:

    protected function updateFile(AbstractFile $file, $identifier = '', $storage = NULL) {
        if ($identifier === '') {
            $identifier = $file->getIdentifier();
        }
        if($file->isDeleted()) {
            $newProperties = array('deleted' => 1);
        } else {
            $fileInfo = $this->driver->getFileInfoByIdentifier($identifier);
            // TODO extend mapping
            $newProperties = array(
                'storage' => $fileInfo['storage'],
                'identifier' => $fileInfo['identifier'],
                'tstamp' => $fileInfo['mtime'],
                'crdate' => $fileInfo['ctime'],
                'mime_type' => $fileInfo['mimetype'],
                'size' => $fileInfo['size'],
                'name' => $fileInfo['name']
            );
        }
        if ($storage !== NULL) {
            $newProperties['storage'] = $storage->getUid();
        }
        $file->updateProperties($newProperties);
        $this->getFileRepository()->update($file);
    }

The last change isn't that nice. would be better the driver returns info about the fact the file is deleted/missing. But at the moment the driver throws an excpetion. Maybe a try...chatch and in the catch set to $newProperties to deleted?

Or only

In \TYPO3\CMS\Core\Resource\ResourceStorage::deleteFile() add:


        // Mark the file object as deleted
        $fileObject->setDeleted();
        $fileObject->updateProperties(array('deleted' => 1));
        $this->getFileRepository()->update($fileObject);

#2

Updated by Gerrit Code Review over 8 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20982

#3

Updated by Gerrit Code Review over 8 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20982

#4

Updated by Gerrit Code Review over 8 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20982

#5

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/22024

#6

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/22025

#7

Updated by Frans Saris over 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#8

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22034

#9

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/22037

#10

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/22038

#11

Updated by Christian Kuhn over 8 years ago

  • Status changed from Under Review to Resolved
#12

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22056

#13

Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch TYPO3_6-1 has been pushed to the review server.
It is available at https://review.typo3.org/22060

#14

Updated by Steffen Ritter over 8 years ago

  • Status changed from Under Review to Resolved
#15

Updated by Gerrit Code Review over 8 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/22064

#16

Updated by Steffen Ritter over 8 years ago

  • Status changed from Under Review to Resolved
#17

Updated by Oliver Hader about 8 years ago

Reverted in all branches due to regressions!

#18

Updated by Chris topher about 8 years ago

  • Status changed from Resolved to New
  • % Done changed from 100 to 0
#19

Updated by Ernesto Baschny about 8 years ago

  • Status changed from New to Needs Feedback
  • Target version set to 6.2.0
  • TYPO3 Version changed from 6.1 to 6.2

Frans, we now have the "missing" flag which is more semantically correct. The "deleted" flag should be dropped as decided in Mainz (#51562). So this issue here is now also obsolete, right?

#20

Updated by Frans Saris about 8 years ago

Yes this issue is obsolete now.

#21

Updated by Ernesto Baschny about 8 years ago

  • Status changed from Needs Feedback to Rejected
  • Is Regression set to No

Also available in: Atom PDF