Skip to main content

Timeline for Convenient way to use wp_filesystem

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Aug 13, 2014 at 20:12 history edited Otto CC BY-SA 3.0
added 4439 characters in body
Aug 13, 2014 at 14:57 vote accept Borek Bernard
Aug 13, 2014 at 14:57 comment added Borek Bernard Thanks, I need to experiment with this more. We use filesystem functions in many places of our plugin and writing ten lines of code every time is simply not manageable. Some good hints in your comments, many thanks.
Aug 13, 2014 at 12:53 comment added Otto As for what I do in my plugins: That very code. See plugins.svn.wordpress.org/pluginception/trunk/pluginception.php
Aug 13, 2014 at 12:50 comment added Otto Borek: Getting some form of credentials from the user is necessary if they have a setup where WP cannot write files directly with the proper ownership. There is no magic way to write files and give them ownership without the credentials of the user to whom the files will be owned by. If their setup allows for direct writing (meaning that the php process is running as the user and not as a special webserver user account), then this method will simply return true here and no form would thus be displayed to the user.
Aug 13, 2014 at 10:56 comment added Borek Bernard The confusing part is the request_filesystem_credentials() method which is described as "Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem" - that is not something I want to do at all. I've noticed that there is the wp_filesystem() method, can it be used to make the code in the OP simpler? Or maybe I could hide those ugly 10 lines behind some custom function? What do you guys do in your plugins?
Aug 13, 2014 at 10:28 comment added Otto Um, no. It's about file ownership, almost entirely. The WP_Filesystem was created to let WP update itself, and for that to happen properly, it needs to be sure that it doesn't introduce any security issues in the process. The WP_Filesystem is a fundamentally a security thing.
Aug 13, 2014 at 9:30 comment added Rup I thought it was about making a consistent interface whether you're hosted on a shell account or an FTP account, not file ownership?
Aug 13, 2014 at 9:22 history answered Otto CC BY-SA 3.0