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.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | backup_migrate_multiple_locations_fix.patch | 708 bytes | Mike Dodd |
Comments
Comment #1
Mike Dodd commentedhere is the patch, as promised
Comment #2
Mike Dodd commentedthis should do the trick
Comment #3
dmitriy.trt commentedPatch works for me. Thanks a lot!
Comment #4
webjakob commentedAnd manually patching from the code above worked for me.
Sweet.
Comment #5
ronan commentedYeah, 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