[TYPO3-dev] Change driver of a FAL file

Christian Opitz christian.opitz at netresearch.de
Wed Oct 29 15:28:08 CET 2014


Hi Philipp, Frans,

I also thought a little bit about this

> Frans Saris wrote:
>> Setting it to $file->getForLocalProcessing(FALSE); should prevent the copy
>> for local storages but I do not know if there are situations where this
>> will break stuff.

I think, we should do this - will probably hand in a patch within the 
next days.

Philipp Gampe wrote:
> I though about this and I think we need to have dedicated functions for
> this, because this should not be mixed with the regular file functions.

I think, a method addFileFromUrl(...) in an interface extending the 
DriverInterface would be enough: The target storage could then check if 
the source storage is remote and publicly available. If yes, it would 
simply tell the target driver to import the file(s) from their public 
URLs. If not, local copies would be required anyway.

I was just about implementing 
TYPO3\CMS\Core\Resource::moveFolderBetweenStorages() when I saw more 
problems popping up:

1.) The moveFolder method currently retrieves ALL files and folders 
within the source folder to later update their identifiers, storage and 
reindex them.
This is probably ok for smaller directories but will definitely break 
with huge directories as all the file and folder instances are held in 
RAM (ultimately in the ResourceFactory). To avoid running into memory 
limit errors it would thus be necessary to tell the ResourceFactory not 
to keep the instances.

2.) Even when the RAM is not flooded by file and folder instances, it's 
likely to run into server time limits on big directories in the backend. 
Although it would be great to have this working there somehow (f.i. by 
handling one file or a chunk of files per request and display a progress 
bar), running those move/copy actions from the console would be more 
reliable and easier to implement. Hence I would provide a setting, if it 
should be possible to transfer files between different drivers within 
the backend, which should be deactivated by default.

What do you think?

Regards,
Christian



More information about the TYPO3-dev mailing list