On WIN7 64bit, PHP 5.4 are several issues:

The first issue is not a problem of the module itself, but
there is an issue with the WIN Constant OS_WINDOWS, on the WIN7 platform
the contant is undefined. This causes the backups to include the partition name
in the .tar, the backup cannot be restored, because the system refuses the creation
of a directory name for example C: in the tmp-directory.
the file resides in drupaldir/modules/system/system.tar.inc LINE 1877
if(defined('OS_WINDOWS') && OS_WINDOWS)
should be:
if((defined('OS_WINDOWS') && OS_WINDOWS) || defined('PHP_WINDOWS_VERSION_MAJOR') && PHP_WINDOWS_VERSION_MAJOR)

includes/sources.archivesources.inc (Line 213):
function drupal_clone is undefined,
this function is removed from drupal 7, a patch may be:
if(function_exists(drupal_clone)) {
$db_settings = drupal_clone($settings);
} else {
$db_settings = clone($settings);
}

includes/files.inc (Line 56):
_backup_migrate_temp_files_delete_file does not delete all directories,
because they aren't empty, a better aproach may be:
function _backup_migrate_temp_files_delete_file($dir) {
if (!file_exists($dir)) {
return true;
}

if (!is_dir($dir)) {
return unlink($dir);
}

foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') {
continue;
}

if (!_backup_migrate_temp_files_delete_file($dir . DIRECTORY_SEPARATOR . $item)) {
return false;
}

}

return rmdir($dir);
}

from: http://stackoverflow.com/questions/1653771/how-do-i-remove-a-directory-t...

Comments

ronan’s picture

Version: 7.x-3.0-alpha1 » 7.x-3.x-dev
Status: Active » Needs work

Awesome. Can you post this as a patch so I can apply it?

ronan’s picture

Status: Needs work » Fixed

This may be related to #2280743: Files restore duplicating directory structure (sites/default/files/sites/default/files) can you try the latest dev and see if you're still having issues on Windows?

Status: Fixed » Closed (fixed)

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

KimNyholm’s picture

Hi, I have inspected the code and tested Drupal 7.37 and Backup and Migrate 7.x.3.1 on Windows 7. The issue with OS_Windows is still present, giving the symptoms described in https://www.drupal.org/node/2320969. The issue with _backup_migrate_temp_files_delete_file is still present. Both can be fixed as described. The issues are not related to #2280743 mentioned above. I am new to Drupal, so I don't know how to proceed from here.

KimNyholm’s picture

Version: 7.x-3.x-dev » 7.x-3.1
Status: Closed (fixed) » Active
KimNyholm’s picture

Status: Active » Needs review
StatusFileSize
new585 bytes

The issue with _backup_migrate_temp_files_delete_file, is that file handles are not closed. This results in - at least on some platforms - that only one level of directories are removed on each call of the function. The attached patch fixes this.
The issue with OS_WINDOWS is handled in update system.tar.inc to latest Archive_Tar (Pear) and hopefully this will be backported to Drupal 7 core.

fastturtle’s picture

Hi guys, I hope this helps:

P.S. Probably you'll get some warnings but it works. Tested on vista and win7.

couturier’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
Status: Needs review » Needs work
KimNyholm’s picture

Status: Needs work » Needs review
Related issues: +#1414508: update system.tar.inc to latest Archive_Tar (Pear)

Just checked.

Please elaborate if more work is needed.

Alex Andrascu’s picture

I don't think this needs anymore work just RTBC.

rickj’s picture

Running on a Linux server, I don't encounter this problem, but not closing handles is never a good practice!

I've applied the patch anyway, and it has no adverse effects.

damienmckenna’s picture

Could someone with a Windows installation please a) confirm the problem still exists, b) test this patch with the latest codebase and let us know if it still solves the problem? Thanks.

couturier’s picture

Wish I could help, but I don't have the setup you are looking for to be able to test this. This module is really suffering from lack of RTBC input for some reason. Is it possible for us to go ahead and commit?

  • DamienMcKenna committed b78312b on 7.x-3.x
    Issue #2293601 by KimNyholm, fastturtle: Errors shown because directory...
damienmckenna’s picture

Status: Needs review » Fixed
Parent issue: » #2942331: Plan for Backup and Migrate 7.x-3.6

I reviewed the code and think it's a-ok. Committed. Thanks.

  • DamienMcKenna committed 08ae9e4 on 7.x-3.x authored by KimNyholm
    Issue #2293601 by KimNyholm, fastturtle: Errors shown because directory...
  • DamienMcKenna committed d76227d on 7.x-3.x
    Revert "Issue #2293601 by KimNyholm, fastturtle: Errors shown because...

Status: Fixed » Closed (fixed)

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