[TYPO3-dev] FAL - deleting files
Stig Nørgaard Færch
snf at dkm.dk
Mon Mar 10 14:37:51 CET 2014
Hello
Is a record in sys_file supposed to be deleted when the file itself is
deleted?
That is what I expect, but that does not happen.
If there is a record in sys_file_reference related to the record in
sys_file, this one will be marked deleted.
//creating storage object from fileStorage id
$storage =
\TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getStorageObject(1);
//Delete old files:
$folder = $storage->createFolder('test/');
$files = $folder->getFiles();
foreach($files as $file) {
DebuggerUtility::var_dump($file->exists()); //TRUE
$file->delete();
DebuggerUtility::var_dump($file->exists()); //FALSE
}
Best regards,
Stig
More information about the TYPO3-dev
mailing list