Project

General

Profile

Actions

Bug #67228

closed

File indexing: Emit signal when file marked as missing?

Added by Christian Reiter almost 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2015-06-01
Due date:
% Done:

100%

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

Description

It might be helpful to emit a signal when TYPO3\CMS\Core\Resource\Index\Indexer::detectMissingFiles() finds a file is missing.

Any extension that adds capabilities concering file management might want to know about that.

This could be added at TYPO3\CMS\Core\Resource\Index\FileIndexRepository::markFileAsMissing() and simply pass the $fileUid from that function.

Actions #1

Updated by Frans Saris almost 9 years ago

  • Status changed from New to Accepted

Makes sense. Not sure if the setMissing() is currently centralized on one please. That needs to be checked.

Could you provide a patch and push it to the review system?

Actions #2

Updated by Gerrit Code Review almost 9 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39877

Actions #3

Updated by Christian Reiter almost 9 years ago

I tested the patch as such:
  • Add a listener that just writes to devlog
  • Ensure FAL index is clean and up-to-date in a local test system
  • Remove a file from fileadmin/ by manual action outside TYPO3 (Explorer, shell...)
  • Run the task "File Abstraction Layer: Update storage index (scheduler)"
  • Check devlog - entry should show up.

About centralizing "markAsMisssing" function:
There is an "on the fly" adding to index occuring when a folder is viewed in the File > List module. Any file created there from outside TYPO3 is newly added to the index.
However the other index actions, such as "markAsMissing" or updating on change, do not seem to be fired in this situation. They only occur on scheduler run.

Actions #4

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39877

Actions #5

Updated by Christian Reiter almost 9 years ago

Hi,

what can I do to get the patch reviewed?

Example use case

When FileIndexRepository emits the suggested signal "recordMarkedAsMissing" , a listener can check whether a different sys_file has a record with the same SHA1 as the missing one and possibly repair references.

Vice versa, when FileIndexRepository emits the existing signal "recordCreated" the listener can check whether the newly added record has the same SHA1 as something that was previously marked missing.

When an external rename/move takes place, which case occurs depends on whether the indexer comes across the "missing" or "added" file first.

Capturing both ensures that any rename/move which does not simultaneously change the content can be "rescued" in terms of fixing references as well as avoiding record duplication, if an extension listening to the signals wants to do that.

Actions #6

Updated by Gerrit Code Review almost 9 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39877

Actions #7

Updated by Christian Reiter almost 9 years ago

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

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF