Comments (11)
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.
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.
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.
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.
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.
@ryanhellyer What issues did you run into? I assume it wouldn't work with FTP access that requires credentials.
from minit.
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.
There are environments with virtual filesystems. For example GAE.
They have their own Filesystem API implementation.
from minit.
@szepeviktor, but how doe that relate to this ticket? Wouldn't file_put_contents() work with them automatically anyway?
from minit.
@ryanhellyer Those fs-s need a Filesystem API implementation.
For example https://wordpress.org/plugins/google-app-engine/
from minit.
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)
- Empty src or href HOT 6
- Exclude 'jquery' container script HOT 2
- Publish on WordPress plugins directory HOT 2
- Support different plugin/theme paths than default ones HOT 9
- Move JS/CSS to foot of page HOT 1
- [off] As simple as minit CDN plugin HOT 2
- Eliminate render-blocking CSS - Issue HOT 2
- Inline scripts registered by 'wp_add_inline_script' are not printed
- How do I unistall the plugin HOT 2
- Include in theme instead of plugin HOT 2
- Add instructions to bump version numbers to trigger cache purge HOT 3
- Add a hook to bump the cache HOT 1
- root relative urls in css are being meesed up HOT 7
- Add support for defer to minit <script> output
- Not compatible with Simple Custom CSS HOT 1
- Exclude JS HOT 5
- Add all contributors to readme.md HOT 1
- Support custom WP_CONTENT_DIR locations HOT 10
- minit_exclude_js & re-enqueue back to header HOT 3
- Moving every helper to the Wiki HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minit.