Create new file in install script

2 posts / 0 new
Last post
#1 Tue, 09/15/2015 - 04:58
Omegote

Create new file in install script

I'm trying to create a new file from a install script, but I don't seem to find the way to do it.

I think I should use open_readfile_as_domain_user, but I don't quite know how to write the lines to the file.

How can I do it?

Tue, 09/15/2015 - 09:38
andreychek

Howdy,

You can do that using "open_tempfile_as_domain_user".

An example of that is as follows:

&open_tempfile_as_domain_user($domain, FILEHANDLE, ">$file_name");
&print_tempfile(FILEHANDLE, "Hello World");
&close_tempfile_as_domain_user($domain, FILEHANDLE);

# And if this file needs to be executable from the web server
&set_permissions_as_domain_user($domain, 0755, $filename);
Topic locked