I've got a bit of code that transfers backups from our development servers, and it randomly seems to behave very strangely and giving the following errors/output:
Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
ERR blahjob: Failed to get file: 2013-09-25_18-22-04-blahjob_dev18.tgz
PHP Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
ERR blahjob: Failed to get file: 2013-09-25_18-22-37-blahjob_dev19.tgz
PHP Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
ERR blahjob: Failed to get file: 2013-09-25_18-23-05-blahjob_dev5.tgz
PHP Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
Warning: ftp_get(): Delete operation successful. in /root/cron/get_dev_archives.php on line 106
ERR blahjob: Failed to get file: 2013-09-25_18-23-37-blahjob_dev33.tgz
I haven't the slightest idea what delete has to do with ftp_get()
, or why it's returning false
and throwing a warning about another operation's success. Google has also been unhelpful in finding any similar issues.
Code in question:
// ftp connection established, file list acquired, yadda yadda
foreach( $targets as $target ) {
$localfile = $backup_dir . $target;
if( file_exists($localfile) ) {
do_log($task['name'], "Local file ".$target." already exists, skipping.", 1);
continue;
}
if( ! ftp_get($conn, $localfile, $target, FTP_BINARY) ) { // line 106
do_log($task['name'], "Failed to get file: ".$target, 2);
} else {
do_log($task['name'], "Got file: ".$target);
ftp_delete($conn, $target);
}
}