Giter VIP home page Giter VIP logo

Comments (11)

kasparsd avatar kasparsd commented on August 17, 2024 2

I think we've had a great discussion about the problems with using WP Filesystem and I suggest we keep using file_put_contents() and close this.

from minit.

sidati avatar sidati commented on August 17, 2024 1

Unfortunately this cannot be happens because sometimes WP File System may ask for credentials of FTP while Minit generate minified files when any user visit the website 😢

from minit.

ryanhellyer avatar ryanhellyer commented on August 17, 2024 1

It keeps throwing errors on various server setups. It just turfs up that annoying "Enter your FTP credentials" junk. I've never found a workaround for that.

The general logic I've been given for using the WP file API is to avoid security concerns relating to extremely poorly shared server environments where users from one environment can overwrite files on another environment when the file owner is set incorrectly. I know there were hosts using this sort of setup back when the file API was added to core, but I really doubt there are many hosts still doing this today, and quite frankly working around setups that poor seem a waste of time.

file_put_contents() is a perfectly valid solution in this situation IMHO. I don't see why WordPress needs to have it's own special way of doing exactly the same thing.

from minit.

kasparsd avatar kasparsd commented on August 17, 2024

Hey @geniuspro! Thanks for reporting that -- it should be changed, indeed.

However, please note that embedding a plugin is considered a bad practice for various reasons -- mainly, users can't install and use the latest version of the same plugin from the repository because of namespace conflicts. Please don't do that.

from minit.

ryanhellyer avatar ryanhellyer commented on August 17, 2024

I've tried implementing this before and failed. If anyone can figure it out, I'd love to hear how you do it.

[note: I mean in a consistent way which doesn't break many sites]

from minit.

kasparsd avatar kasparsd commented on August 17, 2024

@ryanhellyer What issues did you run into? I assume it wouldn't work with FTP access that requires credentials.

from minit.

ryanhellyer avatar ryanhellyer commented on August 17, 2024

I thought I had a solution for this back in 2014, but it turned out after publishing it, that my solution was complete crap. At that point I just gave up and used file_put_contents() ever since.

https://geek.hellyer.kiwi/2014/06/27/saving-css-files-uploads-folder/

from minit.

szepeviktor avatar szepeviktor commented on August 17, 2024

There are environments with virtual filesystems. For example GAE.

They have their own Filesystem API implementation.

from minit.

ryanhellyer avatar ryanhellyer commented on August 17, 2024

@szepeviktor, but how doe that relate to this ticket? Wouldn't file_put_contents() work with them automatically anyway?

from minit.

szepeviktor avatar szepeviktor commented on August 17, 2024

@ryanhellyer Those fs-s need a Filesystem API implementation.
For example https://wordpress.org/plugins/google-app-engine/

from minit.

szepeviktor avatar szepeviktor commented on August 17, 2024

Sorry, bad example.
https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-filesystem-ssh2.php
file_put_contents() does not work on this.

from minit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.