3

I have a drupal 7.43 installation and it has been doing regular backups using the Backup and Restore module. I wanted to do a restore but I'm blocked at every turn it seems. I go to Configuration >> System >> Backup and Migrate >> Saved Backups and click on "restore" next to the one I want to restore from. I get a new page where I choose "Entire Site" to restore to, as that is what I'm backing up, and then click "Restore." That takes me to a white page. When I reload my site, nothing has changed, so I assume this means failure, although I have no way of knowing what failed or why that I can tell.

So I tried drush:

drush bam-restore archive scheduled drupal.xxxxx.net-2016-03-21T09-44-17.sitearchive.tar.gz

This gave me a mysterious error:

Restoring will delete some or all of your data and cannot be undone. ALWAYS TEST YOUR BACKUPS ON A NON-PRODUCTION SERVER!
Are you sure you want to perform the restore? (y/n): y
PHP Fatal error: Call to undefined function file_directory_path() in /var/www/drupal.wealthychef.net/public_html/sites/all/modules/backup_migrate/includes/sources.archivesource.inc on line 211
Drush command terminated abnormally due to an unrecoverable error.
Error: Call to undefined function file_directory_path() in /var/www/drupal.wealthychef.net/public_html/sites/all/modules/backup_migrate/includes/sources.archivesource.inc, line 211

Can someone help me understand how to restore my site?

1
  • I'm pretty sure backup migrate doesn't delete new data like fields etc. so you need to do it on a clean database. Try it on dev server with a new installation, only your sites folder copied and backup migrate enabled. Mar 23, 2016 at 1:40

2 Answers 2

3

This sounds like a bug of Backup and Migrate module, since file_directory_path() no longer exists in Drupal 7.

So instead of file_directory_path() you should use:

file_stream_wrapper_get_instance_by_scheme(file_default_scheme())->getDirectoryPath()

or:

variable_get('file_public_path', conf_path() . '/files')

So please upgrade your module to development version (but it's not fixed yet at time of writing) or use this patch available at: #2618516 - Fatal error when restoring "Entire Site" which goes like:

--- a/includes/sources.archivesource.inc
+++ b/includes/sources.archivesource.inc
@@ -208,7 +208,7 @@ class backup_migrate_files_destination_archivesource extends backup_migrate_dest

       // Move the files from the temp directory.
       if ($filepath && file_exists($filepath)) {
-        _backup_migrate_move_files($filepath, file_directory_path());
+        _backup_migrate_move_files($filepath, variable_get('file_public_path', conf_path() . '/files') );
       }
1

Depending on your version of the Backup Migrate module you may have this bug https://www.drupal.org/node/2618516 - try upgrading the Backup Migrate module and see if you can then restore.

Don't forget to search Google/Duckduckgo/your-favourite-search-engine for issues, and if it is related to a specific module there is no harm in looking in the issue queue for similar issues...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.