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
This commit is contained in:
uli 2017-03-14 08:15:22 +00:00
parent b8ec81329a
commit 30b80d660a

View file

@ -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 = '<?xml version="1.0" encoding="UTF-8"?>' ."\n<travels>\n";
@ -62,10 +63,28 @@ class TripodoExportCommand extends ContainerAwareCommand
$xml .= '</travels>';
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);