function drupal_ftp_connect

cis7 drupal_ftp_connect(&$ftp)
cle7 drupal_ftp_connect(&$ftp)
elmsmedia7 drupal_ftp_connect(&$ftp)
icor7 drupal_ftp_connect(&$ftp)
meedjum_blog7 drupal_ftp_connect(&$ftp)
mooc7 drupal_ftp_connect(&$ftp)

The drupal_ftp_connect function This function connects to an FTP server and attempts to change into the directory specified by the fourth parameter, $directory.

6 calls to drupal_ftp_connect()
drupal_ftp_change_directory in sites/all/modules/ulmus/backup_migrate/includes/
The drupal_ftp_change_directory Function This function simply changes into the $directory folder on the FTP server. If a connection or permission error occurs then _backup_migrate_message() will contain the error message.
drupal_ftp_create_directory in sites/all/modules/ulmus/backup_migrate/includes/
The drupal_ftp_create_directory Function This function tries to make a new directory called $folder_name on the FTP server. If it can create the folder, then the folder is given appropriate rights with the CHMOD command.
drupal_ftp_delete_file in sites/all/modules/ulmus/backup_migrate/includes/
The drupal_ftp_delete_file Function This function attempts to delete a file called $filename from the FTP server.
drupal_ftp_delete_folder in sites/all/modules/ulmus/backup_migrate/includes/
The drupal_ftp_delete_folder Function This function was one of the hardest to write. It recursively deletes all files and folders from a directory called $folder_name.
drupal_ftp_file_to_ftp in sites/all/modules/ulmus/backup_migrate/includes/
Send a file to an FTP server.

... See full list


sites/all/modules/ulmus/backup_migrate/includes/, line 131
Functions to handle the FTP backup destination.


function drupal_ftp_connect(&$ftp) {
  if (is_NULL($ftp)) {
    $ftp = drupal_ftp_ftp_object();

  if (empty($ftp->__conn) && !drupal_ftp_connected($ftp)) {
    // Attempt to connect to the remote server
    $ftp->__conn = @ftp_connect($ftp->__server, $ftp->__port);

    if (!$ftp->__conn) {
      _backup_migrate_message('FTP Error: Couldn\'t connect to server @server', array('@server' => $ftp->__server), 'error');
      return FALSE;

    // Attempt to login to the remote server
    $ftp->__login = @ftp_login($ftp->__conn, $ftp->__user, $ftp->__password);

    if (!$ftp->__login) {
      _backup_migrate_message('FTP Error: Couldn\'t login as user @ftp_user to @server', array('@ftp_user' => $ftp->__user, '@server' => $ftp->__server), 'error');
      return FALSE;

    // Attempt to change into the working directory
    $chdir = @ftp_chdir($ftp->__conn, $ftp->__directory);

    if (!$chdir) {
      _backup_migrate_message('FTP Error: Couldn\'t change into the @directory directory', array('@directory' => $ftp->__directory), 'error');
      return FALSE;

    // Set PASV - if needed
    if ($ftp->__pasv) {
      $pasv = @ftp_pasv($ftp->__conn, TRUE);
      if (!$pasv) {
        _backup_migrate_message('FTP Error: Couldn\'t set PASV mode', array(), 'error');
        return FALSE;

  // Everything worked OK, return TRUE
  return TRUE;