The backup works FINE... however the export task fails for a D8 site:

Error: Call to undefined function variable_get() in /data2/aegir/hostmaster-7.x-3.x-2015-09-11-1331/profiles/hostmaster/modules/aegir/hosting_site_backup_manager/hosting_site_backup_manager.inc, line 12

The task seems to be run in the context of the hosted site, and fails on using the variable_get function which was renamed in D8. I think that such a task should be more something for the hostmaster context.
Any idea if we have another task which does that already?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

helmo created an issue. See original summary.

MrAdamJohn’s picture

When running this - I did not experience "backup fine". There was no backup in the appropriate directory.

Jon Pugh’s picture

FYI there is only one function in this entire file... There's a better way to do this, for sure...

Looking into it.


/**
 * @file
 * Helper functions.
 */

/**
 * Helper function to get the root directory where backups are exported.
 */
function _hosting_site_backup_manager_get_backup_export_root() {
  $root = variable_get('hosting_site_backup_manager_export_root', '/var/aegir/backup-exports');
  return $root;
}
Jon Pugh’s picture

If someone can take this all you have to do is:L

1. Remove hosting_site_backup_manager.inc.
2. Search and replace:

_hosting_site_backup_manager_get_backup_export_root();

for

drush_get_option('aegir_backups_path', '/var/aegir/backup-exports');

Not sure if there was a reason for the include and the helper function. Maybe someone wanted the site itself to define it's own backup path?

Jon Pugh’s picture

FileSize
3.23 KB

Patch attached!

Jon Pugh’s picture

FileSize
3.39 KB

Better patch. This one uses variable_get() when appropriate... I think :)

needs a little more testing, will get back to you.

Jon Pugh’s picture

FileSize
3.39 KB
gboudrias’s picture

Status: Active » Needs work

Seems to work, with a warning:

include_once(/var/aegir/hostmaster-7.x-3.3/profiles/hostmaster/modules/aegir/hosting_site_backup_manager/drush/../hosting_site_backup_manager.inc): failed to open stream: No such file or directory hosting_site_backup_manager.drush.inc:58	
-
include_once(): Failed opening '/var/aegir/hostmaster-7.x-3.3/profiles/hostmaster/modules/aegir/hosting_site_backup_manager/drush/../hosting_site_backup_manager.inc' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') hosting_site_backup_manager.drush.inc:58

This is the line: include_once dirname(__FILE__) . '/../hosting_site_backup_manager.inc';

Did we just forget to remove it? It doesn't seem to do anything.

Marking as "needs work" just in case, but for those in a hurry I can confirm the current patch (#7) will do the job.

Jon Pugh’s picture

Status: Needs work » Needs review
FileSize
3.51 KB

Ah, I didn't see that one. Funny, the include statement appeared. twice. New patch attached!

gboudrias’s picture

Status: Needs review » Closed (fixed)

Thanks, I tested and committed your patch. You rock.

memtkmcc’s picture

Title: support exporting D8 backups » Support exporting D8 backups, but without breaking aegir_backup_export_path
Status: Closed (fixed) » Needs work

This change breaks support for aegir_backup_export_path variable completely. There reason the helper file was in place, is that otherwise the backend couldn't access aegir_backup_export_path variable, which is stored in the database, and against assumption here, is not stored anywhere as a drush option, so the only method to access it is via _hosting_site_backup_manager_get_backup_export_root() wrapper, or variable_get() directly.

In short, this code will always default to /var/aegir/backup-exports, but you will never notice this, unless your Aegir root is different than /var/aegir, like it is in every BOA instance.

$backupdir = drush_get_option('aegir_backup_export_path', '/var/aegir/backup-exports');
memtkmcc’s picture

Status: Needs work » Needs review
FileSize
1.69 KB

Attached is a working workaround. Note that it only hides the problem, because aegir_backup_export_path is not used here anyway. By the way, how are we supposed to be able to use this variable, if it is not set anywhere in the code? There is just no such variable and no such drush option anywhere.

memtkmcc’s picture

And there is still one, now useless line:

include_once dirname(__FILE__) . '/../hosting_site_backup_manager.inc';
helmo’s picture

It's good to note that drush_get_option and variable_get use difference storage... so this would have to be set in two places now :(

The idea of the _hosting_site_backup_manager_get_backup_export_root() function was to centralize that.. missing the fact that variable_get is not available in all Drush contexts.

helmo’s picture

Setting the aegir_backup_export_path variable can be done via a drushrc file .. I've started to document a few of those options in provision.api.php

But it's still weird to have it in two places ... this new patch therefore renames the drush side to provision_backup_export_path.
And it adds a bit to the README file.

  • helmo committed 40a681d on 7.x-3.x
    Issue #2619074 by Jon Pugh, helmo, memtkmcc, gboudrias: Support...
helmo’s picture

Status: Needs review » Fixed

I jammed in even a bit more comment ... and committed.

Status: Fixed » Closed (fixed)

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