Hacking UpdraftPlus (advanced users)

The following list of constants may not be completely up-to-date, but is a rough list of constants that you can define in your wp-config.php (make sure you put them near enough the top to take effect) to alter the behaviour of UpdraftPlus. e.g.

// Warn about any files >25Mb in size (instead of the default of 250Mb)
define('UPDRAFTPLUS_WARN_FILE_SIZE', 1048576*25);

Here are the constants:

  • UPDRAFTPLUS_SEMAPHORE_LOCK_WAIT : the minimum number of seconds that must pass in between backup runs of the same type. Default 180 (3 minutes). If this amount of time has not passed, then the second backup run will abort. The purpose of this constant is to help deal with the weaknesses of WordPress’s built in scheduler (which is prone to starting the same job multiple times, under certain conditions)
  • UPDRAFTPLUS_DATA_OPTIONAL_TABLES : a comma-separated list of tables whose contents are unimportant and can be dropped if resources are too low. This is intended only for large tables (ones which are likely to have huge amounts of data), and only comes into play on low-resource systems. Default: bwps_log,statpress,slim_stats,redirection_logs,Counterize,Counterize_Referers,Counterize_UserAgents,wbz404_logs,wbz404_redirects,tts_trafficstats,tts_referrer_stats,wponlinebackup_generations,svisitor_stat,simple_feed_stats,itsec_log,relevanssi_log,blc_instances,wysija_email_user_stat,woocommerce_sessions (specify without the table prefix).
  • UPDRAFTPLUS_ZIP_EXECUTABLE : where to look for a binary zip executable (full path). If one is found, then it will be used for speedier zip file creation.
  • UPDRAFTPLUS_MYSQLDUMP_EXECUTABLE: where to look for a binary mysqldump executable (full path). If one is found, then it will be used for speedier database dump creation for large tables.
  • UPDRAFTPLUS_ALWAYS_TRY_MYSQLDUMP: by default, UpdraftPlus only tries to use a binary mysqldump for larger tables. If this constant is set to true, then it will always try it. This may be useful if you have a table with single rows that have freakishly large amounts of data in them, leading to a memory shortage – binary mysqldump copes better with this.
  • UPDRAFTPLUS_WARN_FILE_SIZE : UpdraftPlus shows a warning to the user if a very large file is encountered. This is only ever seen if the backup does not complete, and thus it provides a hint as to the possible reason (i.e. resources may be too low to create a zip containing the large file). Specify in bytes.
  • UPDRAFTPLUS_SKIP_FILE_OVER_SIZE : Files larger than this will be skipped (i.e. excluded from the backup). Specify in bytes. There is no default for this option.
  • UPDRAFTPLUS_WARN_DB_ROWS : UpdraftPlus shows a warning to the user if a database table with more rows than this is encountered. This is only ever seen if the backup does not complete, and thus it provides a hint as to the possible reason (i.e. resources may be too low to create a dump containing the large table).
  • UPDRAFTPLUS_CONSOLELOG : If set to true, then all logging output is output on stdout as well as logged in log files. Useful if you are running a backup from the command line.
  • UPDRAFTPLUS_BROWSERLOG : Like  UPDRAFTPLUS_CONSOLELOG, except HTML entities are escaped.
  • UPDRAFTPLUS_NO_BINZIP : Set to true if you never want UpdraftPlus to use a binary zip executable for creating zip files. Useful if you know that the zip executable on your system can’t work (e.g. due to security restrictions) – time may be lost in trying it out.
  • UPDRAFTPLUS_PREFERPCLZIP : Cause UpdraftPlus to always use the PclZip zip engine. This is slower than the others, but very portable (it is pure PHP). It also gives more informative error messages than the ZipArchive engine, so this can be useful if you are receiving zip errors from ZipArchive but without being told exactly what the error is. (And sometimes cases have been seen where ZipArchive gives errors, but PclZip does not – but note that UpdraftPlus often will attempt to automatically switch to PclZip if ZipArchive keeps erroring).
  • UPDRAFTPLUS_SPLIT_MIN : The minimum number of megabytes that the user is allowed to reduce the “split” setting in the expert settings down to. Defaults at 25.
  • UPDRAFTPLUS_PCLZIP_FORCEALLINONE : Speeds up PclZip (if it is being used) by disabling batching if the amount of data (in bytes) is less than the specified amount. You need to make sure that you have enough time available to create the zip – the purpose of batching is because it is usually not possible to predict how long PHP is allowed to run for before the webserver kills it off.
  • UPDRAFTPLUS_CLOUDFILES_USEOLDSDK : When using Rackspace cloud files, force use of the old, deprecated Rackspace SDK. By default, the new SDK is used when possible (which means, PHP >= 5.3.3).
  • UPDRAFTPLUS_WEBDAV_NEVER_CHUNK: When using WebDAV, don’t attempt to send the backup file(s) in chunks – instead, send it all in one go. (Apache’s mod_dav supports chunks; most other WebDAV servers don’t, and occasionally there’s an exotic one that doesn’t manage to even send a useful error code back so that UpdraftPlus can respond – in that case, this define can be useful).
  • UPDRAFTPLUS_S3_OLDLIB : When using Amazon S3, force use of the old SDK. By default, the new SDK is used when possible (which means, PHP >= 5.3.3).
  • UPDRAFTPLUS_LOG_IDENT (default: updraftplus), UPDRAFTPLUS_LOG_FACILITY (default: LOG_USER) : The syslog identity and facility to use if/when logging log messages to syslog (via the Reporting add-on, or UpdraftPlus Premium)
  • UPDRAFTPLUS_DISABLECOMPATNOTICE: Set this to true to prevent UpdraftPlus displaying an admin notice if you are using a version of WordPress that is “too new” (i.e. UpdraftPlus has not yet been tested/is not supported on it). Useful if you like to use the bleeding-edge, pre-release versions of WordPress.
  • UPDRAFTPLUS_NOAUTOBACKUPS: Set this to true to entirely disable UpdraftPlus’ automatic backup feature for pre-upgrade backups (not to be confused with scheduled backups, for backups that run on a timed schedule).
  • UPDRAFTPLUS_UPLOAD_CHUNKSIZE: The chunk size, in bytes, to use for uploading to certain remote storage providers (currently used for Copy.Com and OneDrive). Note that this might need to be a multiple of something sensible, so don’t tweak it unless you know what you’re doing and why.
  • UPDRAFTPLUS_NOADMINLOCK: Set to true to disable UpdraftPlus Premium’s “admin lock” feature. Useful if you forget the password. (Since you’ve got write-access to wp-config.php anyway, you have a more powerful level of access than such locks already).
  • UPDRAFTPLUS_IPV4_ONLY – tell UpdraftPlus storage methods to use IPv4 only, which can help if your host has a broken IPv6 setup (currently only supported by Google Drive and Google Cloud and calls via the WP HTTP API)
  • UPDRAFTPLUS_BINZIP_OPTS – extra command-line options that will be passed to the zip binary (if any). By default, it is used to cause some particular filetypes to be stored without further compression.
  • UPDRAFTPLUS_ADMINBAR_DISABLE – will hide the UpdraftPlus admin toolbar menu entries. (Otherwise, they are only shown to admins – and if the UpdraftPlus settings page is locked with a password, then it only appears for those who have unlocked the UpdraftPlus settings page).
  • UPDRAFTPLUS_EXCLUDE_EXTENSIONS – a comma-separated list of filename extensions that you wish to be excluded from your backup, no matter where those files are found; e.g. zip,mp4
  • UPDRAFTPLUS_DECRYPTION_ENGINE – force decryption to use a particular engine. This currently results in the relevant call to the setPreferredEngine() method in phpseclib. Valid values for the constant are “openssl”, “mcrypt” or “internal”, reflecting phpseclib’s available modes. A particular mode may not be available on your specific PHP setup, depending on what you have installed.
  • UPDRAFTPLUS_ENABLE_SELECT2 – define this to false in order to prevent use of the ‘select2’ dropdown widget. This is useful if you have another component on your site which is interfering (e.g. loading breaking CSS) and preventing the widget from loading properly
  • UPDRAFTPLUS_SUPPRESS_CONNECTION_CHECKS – define this to true to suppress UpdraftPlus’s checks that the WP database connection is still active; this is only useful if your install’s checks are faulty (which has been seen on Amazon Aurora, August 2016).
  • UPDRAFTPLUS_SKIP_CPANEL_QUOTA_CHECK – skip the attempt to ask cPanel what the user’s used/available disk quota is. Not recommended, unless it’s causing you a major problem somehow.
  • UPDRAFTPLUS_DISABLE_WP_CRON_NOTICE – if you disable WP’s cron with DISABLE_WP_CRON and don’t want UpdraftPlus to mention this on its settings page, then you can define this to true. (Though, this makes debugging harder if you find that your cron isn’t working, so please don’t forget doing it!).
  • UPDRAFTPLUS_ENABLE_TOUR : Set this to false to disable all tour-related functionality.

Other advanced usage tips

  • To exclude a directory (including its sub-directories) from being backed up, create a file within it called “.donotbackup” (without the quotes).