[wp-hackers] easy way to request ftp credentials and use them, when directory to write is not writable?..
Dion Hulse (dd32)
wordpress at dd32.id.au
Thu Sep 15 09:20:27 UTC 2011
I'm not quite sure of your question there..
put_contents() is used to write data directly to a file, it truncates
the file in the process of doing so.
So yes, You should read the contents of the file first if you wish to
alter the contents, and then write the altered contents back into the
If you simply want to replace the contents of the file, there's not
need to read it.
On 15 September 2011 19:01, Davit Barbakadze <jayarjo at gmail.com> wrote:
> "$wp_filesystem supports various different file functions, but the
> put_contents() function is the easiest one to understand."
> I think both resources still lack a good writeup on other available
> functions. Should I for example in all cases get the existing file's
> contents before passing them to put_contents() function?
> Davit Barbakadze
>> On Wed, Sep 14, 2011 at 8:37 PM, Otto <otto at ottodestruct.com> wrote:
>>> On Wed, Sep 14, 2011 at 6:04 AM, Davit Barbakadze <jayarjo at gmail.com> wrote:
>>>> Plugins usually request ftp credentials when they are not able to
>>>> install themselves directly. Is there an easy way to leverage the same
>>>> ftp credentials dialog in plugin/theme cases, when there's a necessity
>>>> for example to put a file in a directory, which is not writable? Some
>>>> Codex page on this maybe?
>>> I wrote a tutorial on how to do exactly this:
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers