I have 5 different backup schedules some internal some external and I have been using the same setup on lots of sites. When setting it up on a new site however I noticed that my backups to Amazon S3 were not working and the logs showed me that all 5 backups were being saved locally (the first profile I was using). I then spent an half hour this morning working out why that was and found the bug which is here:

profiles.inc line 12

/**
* Get all the available backup profiles.
*/
function backup_migrate_get_profiles() {
backup_migrate_include('filters');
static $profiles = NULL;

// Get the list of profiles and cache them locally.
if ($profiles === NULL) {
$profiles = backup_migrate_crud_get_items('profile');
}
return $profiles;
}

There is no reason that I can see to have a static Profiles variable here and by doing so it caches the profiles variable on the first run meaning that all subsequent runs use the same profile, which is not good.

I have replaced this with:

function backup_migrate_get_profiles() {
backup_migrate_include('filters');
$profiles = null;
$profiles = backup_migrate_crud_get_items('profile');
return $profiles;
}

and everything is working like a charm now. I have not tired setting this to a global variable but again I don't believe there is a need to do so just using it as a local variable should do the trick.

I haven't made a patch for this yet as I'm not sure that this will not have a negative effect else where.

Will do some more testing but this seems to do the trick.

Comments

Mike Dodd’s picture

StatusFileSize
new708 bytes

here is the patch, as promised

Mike Dodd’s picture

Status: Active » Needs review

this should do the trick

dmitriy.trt’s picture

Status: Needs review » Reviewed & tested by the community

Patch works for me. Thanks a lot!

webjakob’s picture

And manually patching from the code above worked for me.
Sweet.

ronan’s picture

Version: 6.x-2.2 » 6.x-2.x-dev
Status: Reviewed & tested by the community » Fixed

Yeah, the static caching is probably not necessary there since gathering the profiles probably isn't a terribly expensive operation, but I've committed a fix that preservers the caching in case it is giving any benefit. Let me know if the latest dev works.

Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.