• Resolved Richard Foley

    (@richardfoley)



    The WPSSO is a *really* well written piece of code, please see my 5-star review!

    However, one thing bugs me, and that is that there is a WPSSO cache directory under the plugins location. There is a wp-content/cache/ directory for a reason, and this is where *any* volatile cache-like files should be stored. Not under the wp-content/plugins/ directory which should be reserved for library files, NOT cache files.

    Please move the plugins/wpsso/cache/ directory to the wp-content/cache/ directory.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author JS Morisset

    (@jsmoriss)

    Thanks. 🙂

    The wp-content/cache/ directory is actually *not* offered or created by WordPress. The files and folders provided in wp-content/ by WordPress are (example from WP 5.0.1):

    
    wordpress/wp-content$ ls -1
    index.php
    plugins
    themes
    

    I’m guessing that you’re using a caching plugin that created this directory. From experience, I can tell you that permissions are often a problem when creating files and directories, which is why WPSSO Core comes with it’s own cache/ directory. The files stored within are meant to be used by WPSSO Core, and not any other plugins, and are meant to be temporary – when an update to WPSSO Core is installed, the cache/ directory is removed and re-created by the update, which is fine. 🙂 Unlike caching plugins (which often store static files on disk), WPSSO Core caches most of its data in the transient cache (which is retained between updates), not on disk. The cache on disk is generally meant for more recent versions of the Setup Guide and plugin readme.

    You can also use the WPSSO_CACHEDIR constant if you wanted to share a central cache folder between multiple sites, for example, although performance wise, I don’t think it would make much of a difference (files in the cache folder are not updated very often).

    js.

    thanks for your prompt and clear explanation, JS.

    Notwithstanding that, perhaps I should clarify what I was doing which exposed this issue on *my* install. I was updating the WPSSO plugin/s using the *wp cli* tool, and it complained about the files in that cache directory and failed to update until I’d manually removed them. And yes, the file permissions are set as per recommended here: https://codex.wordpress.org/Hardening_WordPress

    I still think it’s the wrong place for cache files, just like I think test outputs should not live near test files (different project). However, in this case as it’s your plugin, I need to go with your decision.

    Thanks again.

    R.

    Plugin Author JS Morisset

    (@jsmoriss)

    The wpsso/ plugin directory, including its cache directory, are extracted by the web server from the ZIP file when installing the plugin. As such, the wpsso/ plugin directory, and all files and directories contained within, should have proper permissions / ownership since they were installed by the web server (thus owned by the web server user). They should also be removable by the web server for updates and uninstalls. Any files created in the cache/ directory would also be created by the web server, so there should not be any issues with permissions when removing the files – WPSSO Core also includes a schedule to cleanup its transients / cached files, and if the web server was not able to create / remove cached files, that would be a problem. 🙂

    I’m not sure why WP CLI would be unable to remove / update the plugin, especially since it was installed by the web server, so the web server should be able to remove / update the plugin without problem. Perhaps that would be an issue to report to the WP CLI support forum?

    js.

    Richard Foley

    (@richardfoley)

    I agree the wp-content/plugins/wpsso/cache/ directory is managed by wpsso, running under the webserver process (with appropriate permissions).

    However, the wp-cli is running from the commandline and was *not* installed via the web server. This is a commandline tool which was installed by the user who owns the wordpress directory. There are therefore differences between the system user who *owns* the installation and the web server group who *runs* the directory.

    The permissions are more lax under wp-content/uploads/ for obvious reasons, and would be an additional candidate location for cache files, but if as you say all other cache plugins are already using wp-content/cache/ for their files then…

    wp-content/cache/wpsso/ still seems the right place to put this kind of stuff.

    Plugin Author JS Morisset

    (@jsmoriss)

    If a site does not allow the web server to install or remove plugins (ie. no write permission), then you kinda have to deal with the complications associated with that, which for WPSSO would mean defining the WPSSO_CACHEDIR and WPSSO_CACHEURL constants.

    I’d rather keep WPSSO as self-contained as possible – I’m not a fan of plugins that create files / database tables all over the place and leave a mess when uninstalled. But I can also see the advantages to keeping cache files for all plugins in a central location – for example, a single cache directory could be put on a RAM disk to improve I/O speed.

    In WPSSO Core v4.18.1-dev.1 (currently in trunk and available to Pro users), the plugin will attempt to use a wp-content/cache/wpsso/ folder, if possible.

    js.

    Richard Foley

    (@richardfoley)

    wp-content/cache/wpsso/ “if possible” is awesome! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.