Hello,
I used one php script I wrote some time ago, which backed up a few more stuff when provision-backup happens (it stored in .drush, where all others are stationed as well).
Here is a code:
function drush_extrabackup_pre_provision_backup($url = NULL) {
if(is_dir('sites/all/modules'))
exec('cp ' . 'sites/all/modules/ ' . d()->site_path . '/all-modules -R');
if(is_dir('sites/all/themes'))
exec('cp ' . 'sites/all/themes/ ' . d()->site_path . '/all-themes -R');
if(is_dir('sites/all/libraries'))
exec('cp ' . 'sites/all/libraries/ ' . d()->site_path . '/all-libraries -R');
}
function drush_extrabackup_post_provision_backup($url = NULL) {
$backup_file = drush_get_option('backup_file');
$path = 'sites/' . trim(d()->name, '@') . '/';
if(is_dir($path))
exec('rm -rf ' . $path . 'all-modules ' . $path . 'all-themes ' . $path . 'all-libraries ');
}
Basically, it adds sites/all/* into backup (not just db and per site folders).
But, since update to Aegir 3, this doesn't work. It seems like API changed, or something I am missing, because this script now doesn't even trigger anymore. Is there some hook or similar, to be able to hook into, to do this additional backup or? I went carefully through http://api.aegirproject.org/ but couldn't find what I am looking for.
Thanks in advance!
Comments
Comment #2
milovan CreditAttribution: milovan commentedComment #3
ergonlogicWhat is the name of the file in which this code resides?
Comment #4
milovan CreditAttribution: milovan commentedIn Aegir 1 and 2, I used name
but since it didn't work, I also tried with name
(still use this name for tests as it looked to me like more correct on,e based on others in .drush folder)
Comment #5
ergonlogicYou could try dropping
drush_log('...', 'warning');
into those commands, to see if they're being triggered.Also, you should consider using drush_shell_exec().
Comment #6
milovan CreditAttribution: milovan commentedI've used so far
but I tried with drush_log as well, and no results (nothing new printed in output when calling:
rush --php='/usr/bin/php' '@example.com' provision-backup
I will take a look at drush_shell_exec as potential alternative, but would like to make this work, if possible. Is there some kind of example with using hook_pre and hook_post that I could look into and compare with mine?
Comment #7
ergonlogicSo, just to be clear, the code is at:
/var/aegir/.drush/extrabackup.drush.inc
?Comment #8
milovan CreditAttribution: milovan commentedI did manual install so path is
/proj/www/aegir/.drush/extrabackup.drush.inc
Comment #9
milovan CreditAttribution: milovan commentedI also checked on a fresh Debian 8 installation and installed Aegir via repository provided on aegir site. It also doesn't work, so it is not up to my manual installation.
Out of curiosity, why there isn't any Drush command to backup whole platform (core code + sites/all code + sites and their databases)? I know for archive-dump, but it makes dump per site which unnecessary multiplies backups of core plus it omits all other sites except one from sites in each backup per site.
So, let's say there are 5 sites in platform, this command makes 5 tar.gz which all have to be extracted, and manually merge each /sites.