From 30b80d660ad034fbeb62ba85aeaa644124eea5cb Mon Sep 17 00:00:00 2001 From: uli Date: Tue, 14 Mar 2017 08:15:22 +0000 Subject: [PATCH] Export zu Tripodo-Server (Bisher wurden nur die Daten erzeugt) git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3316 f459cee4-fb09-11de-96c3-f9c5f16c3c76 --- .../Command/TripodoExportCommand.php | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/trunk/src/AppBundle/Command/TripodoExportCommand.php b/trunk/src/AppBundle/Command/TripodoExportCommand.php index ad42e318..2714346b 100644 --- a/trunk/src/AppBundle/Command/TripodoExportCommand.php +++ b/trunk/src/AppBundle/Command/TripodoExportCommand.php @@ -24,6 +24,7 @@ class TripodoExportCommand extends ContainerAwareCommand { /** @var EntityManager $em */ $em = $this->getContainer()->get('doctrine')->getManager(); + $logger = $this->getContainer()->get('logger'); $regex = '/(\(\s*)?(((https?:\/\/)?www\.stern-?tours\.de[^\s\)]*)|([^\s]+@stern-?tours\.de)|(030\s*(-\s*)?700\s*94\s*100))(\s*\))?/'; $baseUrl = 'https://www.sterntours.de'; $xml = '' ."\n\n"; @@ -62,10 +63,28 @@ class TripodoExportCommand extends ContainerAwareCommand $xml .= ''; file_put_contents('travels.xml', $xml); - return; - $conn = ftp_connect($this->getContainer()->getParameter('tripodo_host')); - if(ftp_login($conn, $this->getContainer()->getParameter('tripodo_user'), - $this->getContainer()->getParameter('tripodo_pass'))) + + $host = $this->getContainer()->getParameter('tripodo_host'); + if (!$host) + { + $logger->error('Tripodo export failed. No host specified ("tripodo_host").'); + return; + } + $user = $this->getContainer()->getParameter('tripodo_user'); + if (!$host) + { + $logger->error('Tripodo export failed. No user name specified ("tripodo_user").'); + return; + } + $pass = $this->getContainer()->getParameter('tripodo_pass'); + if (!$pass) + { + $logger->error('Tripodo export failed. No password specified ("tripodo_pass").'); + return; + } + + $conn = ftp_connect($host); + if(ftp_login($conn, $user, $pass)) { $stream = fopen('travels.xml', 'r'); ftp_fput($conn, 'travels.xml', $stream, FTP_BINARY);