• Resolved James Jones

    (@jamesjonesphoenix)


    Hi folks,

    This might be a feature request. I’m hoping there’s a way to disable automated UpdraftPlus backups through a hardcoded constant which can be placed in wp-config.php.

    Something like define(‘DISABLE_AUTO_BACKUPS’, true). I cannot find something like this at this stage.

    I’m wondering if I could achieve something similar by using UPDRAFT_DEFAULT_UPLOADS_EXCLUDE and UPDRAFT_DEFAULT_OTHERS_EXCLUDE to exclude every folder that is backed up.

    My use case is that I build WordPress websites with a staging site and sometimes for whatever reason I need to export the database from the live site and import it to the staging site. I want automated backups enabled on the live server but disabled on the staging server to save disk space. Obviously I can disable automated backups in WP Admin but this must be re-disabled on the staging site on every import. It’d be great to not have to do that.

    I think many people would have a similar situation so this feature would be well received. Keen to hear your thoughts.

    Cheers,
    James

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor aporter

    (@aporter)

    Hi James,

    Sorry for the delay.

    This can be done via a WordPress filter.

    “updraftplus_boot_backup”

    On your development site in your wp-content folder you need to create the folder “mu-plugins” if you don’t have one.

    Then create a php file in the mu-plugins folder (you can call it anything e.g stop_backup.php).

    Inside your php file add the following code:

    <?php
    
    add_filter('updraftplus_boot_backup', 'updraftplus_boot_backup');
    
    function updraftplus_boot_backup() {		
    	return false;
    }

    The above code will stop the backup when it tries to run.

    Best Wishes,

    Ashley

    • This reply was modified 6 years, 1 month ago by aporter.
    Thread Starter James Jones

    (@jamesjonesphoenix)

    Hi Ashley,

    No apology needed. That snippet was very helpful and seems to have done just what I wanted. Thank you very much!

    Cheers,
    James

    In instance when using Updraft to push to a staging, it would be nice to have a wp-config.php constant that disabled automatic backups in a area that will not be overwritten… so when the staging environment is cloned it doesn’t automatically begin creatng self backups using Updraft.

    kind regards,
    leaving a positive review,
    Hudson

    • This reply was modified 5 years, 11 months ago by Hudson Atwell.
    • This reply was modified 5 years, 11 months ago by Hudson Atwell.
    Thread Starter James Jones

    (@jamesjonesphoenix)

    @hudson-atwell

    You’ve just got to think a little laterally and you’ll realise you don’t need any such constant in the plugin.

    Put this code into your child theme or custom plugin:

    <?php
    add_filter('updraftplus_boot_backup', 'updraftplus_boot_backup');
    
    function updraftplus_boot_backup() {
    	if( defined( 'CUSTOM_DEACTIVATE_UPDRAFTPLUS_BOOT_BACKUP' ) && CUSTOM_DEACTIVATE_UPDRAFTPLUS_BOOT_BACKUP == true )
    	    return false;
            return true
    }

    Then define that constant yourself in wp-config.php as true or false depending on whether it’s a staging site or live site.

    • This reply was modified 5 years, 11 months ago by James Jones.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Disable Automated Backups with wp-config Hardcoded Constant?’ is closed to new replies.