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...
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | backup_migrate_temp_files_delete_file-2293601-6.patch | 585 bytes | KimNyholm |
Comments
Comment #1
ronan commentedAwesome. Can you post this as a patch so I can apply it?
Comment #2
ronan commentedThis 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?
Comment #4
KimNyholm commentedHi, 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.
Comment #5
KimNyholm commentedComment #6
KimNyholm commentedThe 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.
Comment #7
fastturtle commentedHi guys, I hope this helps:
P.S. Probably you'll get some warnings but it works. Tested on vista and win7.
Comment #8
couturier commentedComment #9
KimNyholm commentedJust checked.
Please elaborate if more work is needed.
Comment #10
Alex Andrascu commentedI don't think this needs anymore work just RTBC.
Comment #11
rickj commentedRunning 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.
Comment #12
damienmckennaCould 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.
Comment #13
couturier commentedWish 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?
Comment #15
damienmckennaI reviewed the code and think it's a-ok. Committed. Thanks.