You are here

function drupal_ftp_change_directory in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.2 includes/destinations.ftp.inc \drupal_ftp_change_directory()
  2. 8.3 includes/destinations.ftp.inc \drupal_ftp_change_directory()
  3. 6.3 includes/destinations.ftp.inc \drupal_ftp_change_directory()
  4. 6.2 includes/destinations.ftp.inc \drupal_ftp_change_directory()
  5. 7.2 includes/destinations.ftp.inc \drupal_ftp_change_directory()

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.

1 call to drupal_ftp_change_directory()
drupal_ftp_file_list in includes/destinations.ftp.inc
The drupal_ftp_file_list Function This function will change into the $directory folder and get a list of files and directories contained in that folder. This function still needs a lot of work, but should work in most cases.

File

includes/destinations.ftp.inc, line 277
Functions to handle the FTP backup destination.

Code

function drupal_ftp_change_directory($directory, &$ftp) {

  // Switch to another directory on the web server. If we don't
  // have permissions then an error will occur.
  if (!@drupal_ftp_connect($ftp)) {
    return FALSE;
  }

  // Try and change into another directory.
  $chdir = ftp_chdir($ftp->__conn, $directory);
  if (!$chdir) {
    _backup_migrate_message('FTP Error: Couldn\'t change into directory: @directory', array(
      '@directory',
      $directory,
    ), 'error');
    return FALSE;
  }
  else {

    // Changing directories worked OK.
    return TRUE;
  }
}