BackupWordPress files too big

Last week, I got a notice from my internet service provider that I was using too much space. It turned out to be the BackupWordPress files were too big. They were 16 times the usual size.

My WordPress is installed in a subdirectory of the web root. In the web root directory are all kinds of other files, like pages that are not in the WordPress database and zip files with data for customers. I don’t need to backup these files, because I already have them backed up on other places, and some of them don’t even need to be backed up.

When I downloaded a BackupWordPress backup file and unzipped it, it contained my complete web root, except for the BackupWordPress files it had already made in the past. (There is an exception rule for that directory, you can add more rules.)

The BackupWordPress customer service advised me to check if the BackupWordPress was set to backup the right directory.

I had to add a line to wp-config.php, to set the variable HMBKP_ROOT to the right directory. In PHP it looks like:

define( 'HMBKP_ROOT', ABSPATH );

Still it didn’t work. So I created a little testing PHP file:

<?php
var_dump(ABSPATH);
?>

But it only returned the string ‘ABSPATH’. Then I realized that this variable had not been defined yet. This was also the problem in the wp-config.php file. The ABSPATH variable was defined, but only after it was used to define HMBKP_ROOT.

Placing

/* Aantal backups dat bewaard wordt - Number of back-ups that is saved */
define( 'HMBKP_MAX_BACKUPS', 3 );
define( 'HMBKP_ROOT', ABSPATH );

after

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
 define('ABSPATH', dirname(__FILE__) . '/');

fixed it!

Conclusion

If your BackupWordpress files are too big, check if HMBKP_ROOT is set to ABSPATH after it is defined, in your wp-config.php file. You can find your wp-config.php file in the directory you installed WordPress in.

Geef een reactie