When using scheduled backups with a cleanup rotation, actual backup files are properly removed, but the association .info files describing the deleted backups remain in the target directory.

CommentFileSizeAuthor
#7 backup_migrate-infofiles_1555742.patch1.49 KBmile23

Comments

mile23’s picture

I'm seeing this, too.

~/shared/private/backup_migrate/scheduled/daily $ ls
MySite-2012-05-16T11-56-04.mysql.gz.info
MySite-2012-05-17T13-10-42.mysql.gz.info
MySite-2012-05-18T14-02-54.mysql.gz.info
MySite-2012-05-19T13-49-09.mysql.gz.info
MySite-2012-05-20T14-50-53.mysql.gz.info
MySite-2012-05-21T16-34-42.mysql.gz.info
MySite-2012-05-22T10-30-40.mysql.gz.info
MySite-2012-05-22T10-31-46.mysql.gz
MySite-2012-05-22T10-31-46.mysql.gz.info
MySite-2012-05-23T11-45-54.mysql.gz
MySite-2012-05-23T11-45-54.mysql.gz.info
MySite-2012-05-24T13-07-34.mysql.gz
MySite-2012-05-24T13-07-34.mysql.gz.info
aitala’s picture

Version: 7.x-2.x-dev » 7.x-2.4

This is also happening in the new 7.x-2.4 version as well for both manual and scheduled backups.

filename = "EarthSpaceSciencePartnership-2012-06-05T09-55-19"
description = ""
datestamp = "1338904519"
generator = "Backup and Migrate (http://drupal.org/project/backup_migrate)"
generatorversion = "7.x-2.x"
sites[0][version] = "7.14"
sites[0][name] = "Earth Space Science Partnership"
sites[0][url] = "http://d7.essp.psu.edu/"

Eric

mermentau’s picture

I'm getting the same behavior as described in #2.

magnusk’s picture

The function remove_expired_backups() in includes/schedules.inc is responsible for deleting expired backup files, but it ignores the corresponding .info files.

There are several functions involved in creating and reading metadata from .info files: save_file_info(), create_info_file(), and load_files_info() in includes/destinations.inc

magnusk’s picture

Version: 7.x-2.4 » 7.x-2.x-dev

Leaving orphaned files does not seem minor.

What is the purpose of storing such metadata in these .info files?

mile23’s picture

Priority: Minor » Normal

I agree not minor, but the files are small.

Also if you look at one of the .info files you'll see it's useful information that can't be easily retrieved from inside a gzip file. And I suppose it gets stored as an .info file because Drupal can easily read and write that format.

mile23’s picture

Status: Active » Needs review
StatusFileSize
new1.49 KB

Here's a patch. It seems to work for file destinations. I don't have the resources at the moment to do a thorough test.

attheshow’s picture

I'm also experiencing the problem with the .info files piling up on the server.

Rory’s picture

Patch at #7 works for me. When I manually delete files listed in destinations, the .info files get removed as expected.
B&M 7.x-2.4
Drupal 7.14

mile23’s picture

Status: Needs review » Reviewed & tested by the community

Marking RTBC, so we can hopefully get some movement on this. :-)

rodmaz’s picture

Also reporting the same behavior as #2.

Rory’s picture

@rodmaz - are you reporting this before or after applying the patch at #7?

ronan’s picture

Status: Reviewed & tested by the community » Fixed

This should be fixed in the latest dev. Thanks all.

mile23’s picture

Ossum, thanks.

Status: Fixed » Closed (fixed)

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

WebSinPat’s picture

in case there's anyone else who isn't ready yet to update to the latest releases and just wants a patch. (the patch in #7 is not complete and only works for manual deletion not automatic deletion.) here is a backport of the complete fix that works for me with 7.x-2.4.

diff --git a/includes/destinations.file.inc b/includes/destinations.file.inc
index e4562db..4cc7e93 100644
--- a/includes/destinations.file.inc
+++ b/includes/destinations.file.inc
@@ -93,7 +93,7 @@ class backup_migrate_destination_files extends backup_migrate_destination {
   /**
    * File delete destination callback.
    */
-  function delete_file($file_id) {
+  function _delete_file($file_id) {
     $filepath = $this->get_filepath($file_id);
     file_unmanaged_delete($filepath);
   }
diff --git a/includes/destinations.inc b/includes/destinations.inc
index 513248f..1a9af3e 100644
--- a/includes/destinations.inc
+++ b/includes/destinations.inc
@@ -675,14 +675,32 @@ class backup_migrate_destination extends backup_migrate_item {
     return $files;
   }

+  /**
+   * Create an ini file and write the meta data.
+   */
   function create_info_file($file) {
-    $info = new backup_file(array('filename' => $file->filename() .'.info'));
+    $info = $this->_file_info_file($file);
     $data = _backup_migrate_array_to_ini($file->file_info);
     $info->put_contents($data);
     return $info;
   }

   /**
+   * Create the info file object.
+   */
+  function _file_info_file($file) {
+    $info = new backup_file(array('filename' => $this->_file_info_filename($file->file_id())));
+    return $info;
+  }
+
+  /**
+   * Determine the file name of the info file for a file.
+   */
+  function _file_info_filename($file_id) {
+    return $file_id . '.info';
+  }
+
+  /**
    * Cache the file list.
    */
   function file_cache_set($files) {
@@ -718,6 +736,7 @@ class backup_migrate_destination extends backup_migrate_item {
   function delete_file($file_id) {
     $this->file_cache_clear();
     $this->_delete_file($file_id);
+    $this->_delete_file($this->_file_info_filename($file_id));
   }

   /**
webservant316’s picture

Issue summary: View changes

Hey I am using Backup and Migrate 7.x-2.8 and still have .info files. Re-opening this ticket.

webservant316’s picture

Status: Closed (fixed) » Active
couturier’s picture

Status: Active » Closed (outdated)

The 7.x-2.x branch is being deprecated. Please upgrade to the latest 7.x-3.2 version and see if it addresses your issue.