ssh2_scp_send example

$username = empty($settings['username']) ? '' : $settings['username'];
    $password = empty($settings['password']) ? '' : $settings['password'];
    $hostname = empty($settings['advanced']['hostname']) ? 'localhost' : $settings['advanced']['hostname'];
    $port = empty($settings['advanced']['port']) ? 22 : $settings['advanced']['port'];
    return new SSH($jail$username$password$hostname$port);
  }

  /** * {@inheritdoc} */
  protected function copyFileJailed($source$destination) {
    if (!@ssh2_scp_send($this->connection, $source$destination)) {
      throw new FileTransferException('Cannot copy @source_file to @destination_file.', 0, ['@source' => $source, '@destination' => $destination]);
    }
  }

  /** * {@inheritdoc} */
  protected function copyDirectoryJailed($source$destination) {
    if (@!ssh2_exec($this->connection, 'cp -Rp ' . escapeshellarg($source) . ' ' . escapeshellarg($destination))) {
      throw new FileTransferException('Cannot copy directory @directory.', 0, ['@directory' => $source]);
    }
  }
Home | Imprint | This part of the site doesn't use cookies.