Genesis auto-update doesn't respect DISALLOW_FILE_EDIT

Community Forums Forums General Discussion Genesis auto-update doesn't respect DISALLOW_FILE_EDIT

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  benValice 8 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #88202

    benValice
    Member
    Post count: 6

    WordPress has a DISALLOW_FILE_EDIT constant which is used to tell plugins and themes to not edit the file system under any circumstances. Looking through the code for the genesis auto-update system, it doesn’t look like Genesis respects this constant though.

    When DISALLOW_FILE_EDIT is set to true WordPress hides items such as the theme code editor, and plugin installation page, so it’d make sense that Genesis should completely hide the auto-update option field, and never check for updates.

    It might not be a bad idea to also introduce some of your own constants to control Genesis auto updating.

    • This topic was modified 8 months, 3 weeks ago by  benValice.
    • This topic was modified 8 months, 3 weeks ago by  Susan.
    • This topic was modified 8 months, 3 weeks ago by  benValice.
    • This topic was modified 8 months, 3 weeks ago by  Susan.
    #88299

    Gary Jones
    Moderator
    Post count: 693

    Hi Ben,

    I’m afraid you’re mistaken – the constant is for disallowing the editing of files via the built-in Theme and Plugin Editors – not for disabling auto-updates of themes, plugins or core. As such, Genesis should not be looking for this constant.

    If you want to disable auto-updates, there’s the theme setting. If you want to disable programatically then you can use add remove_theme_support( 'genesis-auto-updates' ); sometime after the genesis_init priority 10 hook fires. Removing theme support will also hide the corresponding options on the Theme Settings page, so users won’t even know about it.

    Question is, why would you want to disable automatic updates?


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1, 2.1.1 and 2.1.2 (all 90 of them!) | @GaryJ

    #88398

    benValice
    Member
    Post count: 6

    Excuse me, I linked to the wrong constant, you’re correct about DISALLOW_FILE_EDIT, I was thinking about DISALLOW_FILE_MODS; my mistake. I use these constants because we manage WordPress sites with git and composer, composer managing plugin and theme dependencies (such as Genesis). Allowing WordPress or Genesis to autoupdate makes the production, development, and staging go out of sync; which can cause issues during development.

    #88447

    Gary Jones
    Moderator
    Post count: 693

    I’ve not dived into it fully, but the WP core already checks for DISALLOW_FILE_MODS, and disables all updates accordingly, so it may be that Genesis can’t update anyway if that constant is true.

    You could try setting Genesis version to 2.0.1, defining the constant to be true, then visiting the Updates page (or waiting at least 12 hours), and see if Genesis says an update is available. If so, then there’s a problem (with a relatively simple fix in Genesis that would probably be in 2.1 if so), and if not, then everything is working. Do let me know the result.

    As stated earlier, if you want to explicitly disable Genesis automatic updates, regardless of whether the constant is defined as true, you can do.


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1, 2.1.1 and 2.1.2 (all 90 of them!) | @GaryJ

    #88452

    benValice
    Member
    Post count: 6

    Perhaps I’m misunderstanding the system. Looking through it now it seems you’re actually handing off to WordPress to update the files, and providing information for it using the genesis_update_push function? If so then WordPress would respect the constant and not attempt to update?

    If so, then really I’d just recommend hiding the option panel if DISALLOW_FILE_MODS is set to true, as the options are no longer used anywhere.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.