Updates don't overwrite files
rallycivic - January 22, 2009 - 15:41
| Project: | Plugin Manager |
| Version: | 6.x-1.9 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Before I installed the php ftp module, (so ftp_connect was not found, and ftp_plugin_manager_copy_wrapper() was used), installs worked OK, but updates did not seem to actually update. I noticed that one update created some new files, so guessed existing files were not being overwritten.
I added this to remove files before copying the new ones in ftp.backend.inc:
if (file_exists( $ftp_path/$file )) {
unlink( "$ftp_path/$file" );
}
above the
@copy($extract_dir . $file, "$ftp_path/$file");
in ftp_plugin_manager_copy_wrapper().
Upgrades then worked, but on my server the "file_exists" line cause division by zero errors, so this isn't a good solution.

#1
We really should uninstall before try to reinstall. Thanks for point that out!
#2
rallycivic,
Thank you for posting that code. You may find (as I did) that using "is_file" instead of "file_exists" will solve your problem:
if (is_file( $ftp_path/$file )) {unlink( "$ftp_path/$file" );
}
#3
Subscribing.