public function getPassword() { return $this->password; } /** * Set the remote file path * * @return string
*/ public function getWrittenFiles() { return $this->writtenFiles; } /** * Set the host of the SFTP Connection * * @param string $delimiter */ public function setHost($host) { $this->host = $host; } /** * Get the port of the SFTP Connection * * @return string */ public function getHost() { return $this->host; } /** * Set the port of the SFTP Connection *
/** * @param array|AbstractProductMedia $media * //TODO Add a "/" after the image folder path * * @return void */ public function sendMedia($media) { $filePath = null; $exportPath = null; if (is_array($media)) { $filePath = $media['filePath']; $exportPath = $media['exportPath']; } else { if ('' !== $media->getFileName()) { $filePath = $media->getFilePath(); } $exportPath = $this->mediaManager->getExportPath($media); } if (null === $filePath) { return; } $dirname = dirname($exportPath); $sftpConnection = new SFTPConnection($this->getHost(), $this->getPort()); $sftpConnection->login($this->getUsername(), $this->getPassword()); $sftpConnection->createDirectory($this->getImageFolderPath() . $dirname); $sftpConnection->uploadFile($filePath, $this->getImageFolderPath() . $exportPath); }