Bug #48336

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

Added by Frans Saris about 2 years ago. Updated almost 2 years ago.

Status:Rejected Start date:2013-05-17
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:File Abstraction Layer (FAL) Spent time: -
Target version:6.2.0
TYPO3 Version:6.2 Is Regression:No
PHP Version: Sprint Focus:
Complexity:

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 Core - Feature #48182: File-Indexer doesn't flag missing files as deleted Closed 2013-05-14
related to Core - Bug #50363: Fatal error: Call to undefined method TYPO3\CMS\Core\Reso... Rejected 2013-07-24
related to Core - Bug #50508: Re-uploading file in backend fails Resolved 2013-07-29
related to Core - Bug #50531: Deleted state is not persisted in file objects Closed 2013-07-29
related to Core - Task #50876: Handling of deleted files in FAL New 2013-08-06

Associated revisions

Revision d22cea3b
Added by Frans Saris about 2 years ago

[BUGFIX] sys_file record doesn't get flagged as delete

File is deleted by driver and deleted property of FileObject is set by
ResourceStorage but new state is not persisted.

Update deleted property in updateProperties array in FileObject and
persist change.

Fixes: #48336
Releases: 6.2, 6.1, 6.0
Change-Id: I6cac106dcf89125e0b98b8b12a03c0b3f56d484f
Reviewed-on: https://review.typo3.org/20982
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

Revision 27039510
Added by Frans Saris about 2 years ago

[BUGFIX] sys_file record doesn't get flagged as delete

File is deleted by driver and deleted property of FileObject is set by
ResourceStorage but new state is not persisted.

Update deleted property in updateProperties array in FileObject and
persist change.

Fixes: #48336
Releases: 6.2, 6.1, 6.0
Change-Id: I6cac106dcf89125e0b98b8b12a03c0b3f56d484f
Reviewed-on: https://review.typo3.org/22024
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

Revision 66e08fe0
Added by Frans Saris about 2 years ago

[BUGFIX] sys_file record doesn't get flagged as delete

File is deleted by driver and deleted property of FileObject is set by
ResourceStorage but new state is not persisted.

Update deleted property in updateProperties array in FileObject and
persist change.

Fixes: #48336
Releases: 6.2, 6.1, 6.0
Change-Id: I6cac106dcf89125e0b98b8b12a03c0b3f56d484f
Reviewed-on: https://review.typo3.org/22025
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

Revision f3778d8c
Added by Christian Kuhn about 2 years ago

Revert "[BUGFIX] sys_file record doesn't get flagged as delete"

This reverts commit d22cea3b61ffec1931bf5b12dd9cddde5eb28ca1

The patch kills unit tests. We guess there is some incomplete
mocking in Resource tests but are not able to quickly find
the root of it. The patch is reverted for now until the tests
are green again.

Change-Id: I5e7bb6e14187f7179e00b0b00decda644e1c6efe
Resolves: #48336
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/22034
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision e1991aec
Added by Christian Kuhn about 2 years ago

Revert "[BUGFIX] sys_file record doesn't get flagged as delete"

This reverts commit 27039510ebf9e456330face27d465863af5d0a0c

The patch kills unit tests. We guess there is some incomplete
mocking in Resource tests but are not able to quickly find
the root of it. The patch is reverted for now until the tests
are green again.

Change-Id: I5e7bb6e14187f7179e00b0b00decda644e1c6efe
Resolves: #48336
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/22037
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision 31b29c04
Added by Christian Kuhn about 2 years ago

Revert "[BUGFIX] sys_file record doesn't get flagged as delete"

This reverts commit 66e08fe0d978ee6ca6ce1c965ae99678a4f0c88b

The patch kills unit tests. We guess there is some incomplete
mocking in Resource tests but are not able to quickly find
the root of it. The patch is reverted for now until the tests
are green again.

Change-Id: I5e7bb6e14187f7179e00b0b00decda644e1c6efe
Resolves: #48336
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/22038
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn

Revision 18bb6574
Added by Steffen Ritter about 2 years ago

[BUGFIX] sys_file record doesn't get flagged as delete

File is deleted by driver and deleted property of FileObject is set by
ResourceStorage but new state is not persisted.
Update deleted property in updateProperties array in FileObject and
persist change.

Reintroduced after fixing tests in f3778d8c8cfe93ccdb8cfa.

Change-Id: I0784c84af4bfb8021c648139c2feee577f3e9dc1
Fixes: #48336
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/22056
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

Revision 640e4d51
Added by Steffen Ritter about 2 years ago

[BUGFIX] sys_file record doesn't get flagged as delete

File is deleted by driver and deleted property of FileObject is set by
ResourceStorage but new state is not persisted.
Update deleted property in updateProperties array in FileObject and
persist change.

Reintroduced after fixing tests in 9f081830c3537e286378e406579e914ffc162969.

Change-Id: I0784c84af4bfb8021c648139c2feee577f3e9dc1
Fixes: #48336
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/22060
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

Revision f45af2ce
Added by Steffen Ritter about 2 years ago

[BUGFIX] sys_file record doesn't get flagged as delete

File is deleted by driver and deleted property of FileObject is set by
ResourceStorage but new state is not persisted.
Update deleted property in updateProperties array in FileObject and
persist change.

Reintroduced after fixing tests in 836dbc652033e118967eccc0bae2ebbde8637735.

Change-Id: I0784c84af4bfb8021c648139c2feee577f3e9dc1
Fixes: #48336
Releases: 6.2, 6.1, 6.0
Reviewed-on: https://review.typo3.org/22064
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

History

#1 Updated by Frans Saris about 2 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 about 2 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 about 2 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 about 2 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 about 2 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 about 2 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 about 2 years ago

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

#8 Updated by Gerrit Code Review about 2 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 about 2 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 about 2 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 about 2 years ago

  • Status changed from Under Review to Resolved

#12 Updated by Gerrit Code Review about 2 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 about 2 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 about 2 years ago

  • Status changed from Under Review to Resolved

#15 Updated by Gerrit Code Review about 2 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 about 2 years ago

  • Status changed from Under Review to Resolved

#17 Updated by Oliver Hader about 2 years ago

Reverted in all branches due to regressions!

#18 Updated by Chris topher about 2 years ago

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

#19 Updated by Ernesto Baschny almost 2 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 almost 2 years ago

Yes this issue is obsolete now.

#21 Updated by Ernesto Baschny almost 2 years ago

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

Also available in: Atom PDF