XF 2.0 Write internal_data

Lukas W.

Well-known member
What would be the recommended way to write to the internal_data directory?

My goal is to build a collection of files similar to the facebook privacy report there through a job, then zip them all once the gathering is complete and make it available for download through the ACP. I've had a few tries at writing to the data (not internal_data) directory in my add-ons, but I still feel like they're kinda hackish somehow.
 
Here's how I write a singular file to the internal_data directory:
PHP:
File::writeFile(
    File::canonicalizePath(\XF::app()->config('internalDataPath') . '/dbtechEcommerce/invoices/') . $fileName,
    $this->output(),
    false
);
(The false is to not write an index.html file)

I'm reasonably certain that's an accurate way of doing it.

If you want to learn how XF2 makes zip files, look into \XF\Service\AddOn\ReleaseBuilder.php as that is the class that sorts out the generation of XF2's release zips.


Fillip
 
Back
Top Bottom