Bug #67228

File indexing: Emit signal when file marked as missing?

Added by Christian Reiter about 4 years ago. Updated 10 months ago.

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

100%

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.

Associated revisions

Revision c54ac942 (diff)
Added by Christian Reiter about 4 years ago

[FEATURE] Emit Signal when an IndexRecord is marked as missing

Introduce a new signal that is emitted when the FAL indexer encounters
a sys_file record which does not have a corresponding filesystem entry
and marks it as missing.

Releases: master
Resolves: #67228
Change-Id: I8419e0919cb9019160782b9de58f3db3fc32352a
Reviewed-on: http://review.typo3.org/39877
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Frank Nägler <>
Tested-by: Frank Nägler <>

History

#1 Updated by Frans Saris about 4 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?

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

#3 Updated by Christian Reiter about 4 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.

#4 Updated by Gerrit Code Review about 4 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

#5 Updated by Christian Reiter about 4 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.

#6 Updated by Gerrit Code Review about 4 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

#7 Updated by Christian Reiter about 4 years ago

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

#8 Updated by Benni Mack 10 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF