From 2817f20583d1de57cf73975ff485875fb3aa0c01 Mon Sep 17 00:00:00 2001 From: argiepiano Date: Thu, 14 Dec 2023 20:45:55 -0700 Subject: [PATCH 1/2] Issue #136. Fix restoring of site. --- includes/sources.archivesource.inc | 34 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/includes/sources.archivesource.inc b/includes/sources.archivesource.inc index 1412249..50e13e3 100755 --- a/includes/sources.archivesource.inc +++ b/includes/sources.archivesource.inc @@ -77,9 +77,9 @@ class backup_migrate_files_destination_archivesource extends backup_migrate_dest $file->push_type('sitearchive'); $gz = new Archive_Tar($file->filepath(), false); - $gz->addModify(array($manifest), $file->name .'/', dirname($manifest)); - $gz->addModify($files, $file->name .'/docroot', $base_dir); - $gz->addModify($db, $file->name . '/', dirname($db)); + $gz->addModify(array($manifest), '/', dirname($manifest)); + $gz->addModify($files, 'docroot', $base_dir); + $gz->addModify($db, '/', dirname($db)); unlink($manifest); rmdir(dirname($manifest)); @@ -145,10 +145,14 @@ class backup_migrate_files_destination_archivesource extends backup_migrate_dest 'database-file-driver' => 'mysql', ), ); - if ($private = config_get('system.core','file_private_path')) { - $info['Site 0']['files-private'] = 'docroot/' . $private; - } - $info['Site 0']['files-public'] = 'docroot/' . config_get('backup_migrate.settings','file_public_path'); + + // TODO: backup of private files doesn't work in D7 or Backdrop. Therefore + // this key should not be included in the manifest. Otherwise the restore + // of the rest of the files is never completed. + // if ($private = config_get('system.core','file_private_path')) { + // $info['Site 0']['files-private'] = 'docroot/' . $private; + // } + $info['Site 0']['files-public'] = 'docroot/' . config_get('system.core','file_public_path'); $ini = $this->_array_to_ini($info); $tmpdir = backup_migrate_temp_directory(); @@ -201,16 +205,22 @@ class backup_migrate_files_destination_archivesource extends backup_migrate_dest $docroot = $temp . '/' . $site['docroot']; $sqlfile = $temp . '/' . $site['database-file-default']; $filepath = NULL; - if (isset($site['files-private'])) { - $filepath = $temp . '/' . $site['files-private']; - } - else if (isset($site['files-public'])) { + // TODO: currently, there is no way to backup or restore private files, + // since they often are outside the installation root. This feature does + // not work in D7 either. I will comment these out instead of removing, + // just in case there is a solution for this in the future. + + // if (isset($site['files-private'])) { + // $filepath = $temp . '/' . $site['files-private']; + // } + // else if (isset($site['files-public'])) { + if (isset($site['files-public'])) { $filepath = $temp . '/' . $site['files-public']; } // Move the files from the temp directory. if ($filepath && file_exists($filepath)) { - _backup_migrate_move_files($filepath, config_get('backup_migrate.settings','file_public_path') ); + _backup_migrate_move_files($filepath, config_get('system.core','file_public_path') ); } else { _backup_migrate_message('Files were not restored because the archive did not seem to contain a files directory or was in a format that Backup and Migrate couldn\'t read', array(), 'warning'); From d343ed5a6ba448c292f1a6ec4d3341bb4ad8761b Mon Sep 17 00:00:00 2001 From: argiepiano Date: Thu, 14 Dec 2023 21:14:56 -0700 Subject: [PATCH 2/2] Remove file paths from config - these are in system.core --- config/backup_migrate.settings.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/backup_migrate.settings.json b/config/backup_migrate.settings.json index e55d5b7..caae734 100644 --- a/config/backup_migrate.settings.json +++ b/config/backup_migrate.settings.json @@ -4,8 +4,6 @@ "backup_migrate_data_bytes_per_line": 2048, "backup_migrate_max_email_size": 20971520, "backup_migrate_allow_backup_to_file": true, - "file_private_path": false, - "file_public_path": false, "backup_migrate_allow_backup_to_download": true, "debug_http_request": false, "dev_query": 0,