### Eclipse Workspace Patch 1.0 #P boekv2 Index: sites/all/modules/contrib_patched/drupal_ftp2/drupal_ftp2.module =================================================================== --- sites/all/modules/contrib_patched/drupal_ftp2/drupal_ftp2.module (revision 43) +++ sites/all/modules/contrib_patched/drupal_ftp2/drupal_ftp2.module (working copy) @@ -117,6 +117,15 @@ * are returned to the caller of the function. */ function drupal_ftp2_ftp_to_data($file_name, $directory, &$ftp) { + $temp_file = drupal_ftp2_ftp_to_file($file_name, $directory, $ftp); + + return drupal_ftp2_file_to_data($temp_file); +} + +/** + * This will download the file from ftp into a temp folder + */ +function drupal_ftp2_ftp_to_file($file_name, $directory, &$ftp) { // Change into the remote directory and retrieve the content // of a file. Once retrieve, return this value to the caller @@ -146,6 +155,13 @@ return FALSE; } + return $temp_file; +} + +/** + * Will write the file data to a var + */ +function drupal_ftp2_file_to_data($temp_file) { // The file was downloaded successfully. Let's open it, read in its // contents and return it to the calling function @@ -155,12 +171,13 @@ drupal_ftp2_error(t('Unable to open @filename after it was downloaded from {@server}', array('@filename' => $file_name, '@server' => $_drupal_ftp2->__server))); return FALSE; } - - // Read in the contents of the file to a variable + + // Read in the contents of the file to a variable $data = ''; - $file = file($temp_file); - $data = array_map('utf8_encode', $file); + while (!feof($fp)) { + $data .= fread($fp, 4096); + } @fclose($fp);