XF 2.0 Move files to abstracted path

Snog

Well-known member
Chris D said:
As a workaround, assuming these are "default" images for something, you might want to have the default images in a different directory and then copy them during install to the abstracted path. Otherwise you will be having to expect people to upload those manually if they aren't using a default setup.

@Chris D OK, so I lied. But, I didn't expect to have any questions.

I do have a couple of add-ons that have literally hundreds of files that are used for various purposes, that need to be included in the data path. Mainly because they get updated periodically by a cron task or they can be written to by other processes using the abstracted file system.

I can walk the directories and individually copy the files with 'copyFileToAbstractedPath'. But that seems a bit cumbersome.

'renameFile' works locally to move the entire directory using 'config('externalDataPath')', but would it also work in the cases you mentioned?

Or if you have another suggestion, I'm open to it. :)
 
externalDataPath is really only used now to control the location of that path on the local file system so it only applies if the local file system is used.

copyFileToAbstractedPath would really be the only way to do it.
 
Thanks @Chris D , the process is done for one of my add-ons.

One more question/comment...

While I don't have enough files where I think it would be a problem, in the event that files are being written to the cloud or over any network connection, that will slow things down tremendously. So the possibility exists that the process could time out.

Any suggestions how to handle that if it should happen? I don't think there's a file_exists check for copyFileToAbstractedPath so files already written aren't written again, or did I miss it?
 
Just a quick note to say that all of my add-ons for XF 2 released to date are using abstractPaths for everything (including during installs). There's nothing directly including the data/ path any more.

Thanks to @Chris D and @Mike for bringing this to my attention and for the info.
 
Top Bottom