Ciao a tutti,
vorrei fare il download di un file csv fa una fonte ftp con credenziali. Ho trovato ftp put ma appunto mette su e non ha il cron...

Allora ho aggiunto l hook cron ma non funziona!!
Invece la stessa funzione in sites/all/libraries FUNZIONA!!

Mi sapete dire come mai?

/**
* Implements hook_cron().
*/
function fp_ui_cron() {
  // qui il downloda va molto bene e gira
  require_once DRUPAL_ROOT.'/'.variable_get('fp_ui_path_to_dwftp', 'sites/all/libraries/downloadtoftp.inc');
  $copied = _ftp_copy_ondownload();

if (variable_set('fp_ui_cron_get', 1) == 1){
  $ftp_server = variable_get('fp_ui_server_get', '');
  $ftp_login = variable_get('fp_ui_login_get', '');
  $ftp_pass = variable_get('fp_ui_password_get', '');

  $fp_ui_local_dir_get = variable_set('fp_ui_local_dir_get', ''); // example csv_imports/filename.ext
  $fp_ui_login_get = variable_set('fp_ui_login_get', '');
  $fp_ui_password_get = variable_set('fp_ui_password_get', '');
  if ($ftp_server !='' && $fp_ui_local_dir_get !='' && $fp_ui_login_get !='' && $fp_ui_password_get !='' ){
    if (variable_get('fp_ui_ssl_get', 0) == 1 && function_exists('ftp_ssl_connect_get')) {
   $connect_result = ftp_ssl_connect($ftp_server);
    } else{
   $connect_result = ftp_connect($ftp_server);
    }
    if ($connect_result === FALSE) {
   watchdog('ftp_getandput', 'Ftp getandput module is unable to make an FTP connection to: %ftp_server.', array('%ftp_server' => $ftp_server), WATCHDOG_ALERT);
    }

    // change directory if it is given in settings
    $remote_dir = variable_get('fp_ui_dir_get', '/');
   $cd_result = ftp_chdir($connect_result, $remote_dir);
   if ($cd_result === FALSE) {
     watchdog('ftp_getandput', 'Ftp getandput module is unable to change directory on the FTP server to: %remote_dir.', array('%remote_dir' => $remote_dir), WATCHDOG_ALERT);
    }

  // login to the FTP server
    $login_result = ftp_login($connect_result, $ftp_login, $ftp_pass);
    if ($login_result === FALSE) {
   watchdog('ftp_getandput', 'Ftp getandput module is unable to login to the FTP server at %ftp_server.', array('%ftp_server' => $ftp_server), WATCHDOG_ALERT);
    }
    $fp_ui_local_filename_get = variable_set('fp_ui_local_filename_get', ''); // example only: filename.ext
    $filename = variable_set('fp_ui_local_dir_get', ''); // example csv_imports/filename.ext
     $where_download = variable_get('file_public_path', conf_path().'/files').'/' . $filename;

    // now download file
    $download = ftp_get($connect_result, $where_download, $fp_ui_local_filename_get, FTP_BINARY);
    if ($download) {
     watchdog("ftp_getandput", "Success: at cron download file @filename.", array('@filename' => $file_to_download), WATCHDOG_INFO);
     return true;
   } else {
     watchdog("ftp_getandput", "Failed: at cron impossible download file @filename.", array('@filename' => $file_to_download), WATCHDOG_INFO);
     return false;
   }
    ftp_close($connect_result);
}
}
}

PS... che serve drupal se poi devo programmare io??