Merge branch 'master' into dist/envole/6/master
This commit is contained in:
commit
34123aeb58
|
@ -13,6 +13,7 @@ use Doctrine\DBAL\Connection as DBALConnection;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Symfony\Component\Validator\Constraints\DateTime;
|
use Symfony\Component\Validator\Constraints\DateTime;
|
||||||
use it\thecsea\simple_caldav_client\SimpleCalDAVClient;
|
use it\thecsea\simple_caldav_client\SimpleCalDAVClient;
|
||||||
|
use it\thecsea\simple_caldav_client\CalDAVException;
|
||||||
|
|
||||||
use Cadoles\PortalBundle\Entity\Calendarevent;
|
use Cadoles\PortalBundle\Entity\Calendarevent;
|
||||||
|
|
||||||
|
@ -437,7 +438,6 @@ class SynchroICSCommand extends Command
|
||||||
$idcalendar = $input->getArgument('idcalendar');
|
$idcalendar = $input->getArgument('idcalendar');
|
||||||
|
|
||||||
|
|
||||||
$PROXYactivate = $this->em->getRepository("CadolesCoreBundle:Config")->findOneBy(["id"=>"PROXYactivate"])->getValue();
|
|
||||||
$PROXYserver = $this->em->getRepository("CadolesCoreBundle:Config")->findOneBy(["id"=>"PROXYserver"])->getValue();
|
$PROXYserver = $this->em->getRepository("CadolesCoreBundle:Config")->findOneBy(["id"=>"PROXYserver"])->getValue();
|
||||||
$PROXYport = $this->em->getRepository("CadolesCoreBundle:Config")->findOneBy(["id"=>"PROXYport"])->getValue();
|
$PROXYport = $this->em->getRepository("CadolesCoreBundle:Config")->findOneBy(["id"=>"PROXYport"])->getValue();
|
||||||
|
|
||||||
|
@ -461,6 +461,7 @@ class SynchroICSCommand extends Command
|
||||||
case 1:
|
case 1:
|
||||||
$this->writeln($calendar->getId()." = ICS = ".$calendar->getUrl());
|
$this->writeln($calendar->getId()." = ICS = ".$calendar->getUrl());
|
||||||
$client = new CalFileParser();
|
$client = new CalFileParser();
|
||||||
|
$PROXYactivate = $this->em->getRepository("CadolesCoreBundle:Config")->findOneBy(["id"=>"PROXYactivate"])->getValue();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if($PROXYactivate)
|
if($PROXYactivate)
|
||||||
|
@ -555,25 +556,44 @@ class SynchroICSCommand extends Command
|
||||||
|
|
||||||
// CalDav
|
// CalDav
|
||||||
case 2:
|
case 2:
|
||||||
|
// Création du client calDAV
|
||||||
|
$this->writeln("");
|
||||||
$this->writeln($calendar->getId()." = CalDAV = ".$calendar->getUrl());
|
$this->writeln($calendar->getId()." = CalDAV = ".$calendar->getUrl());
|
||||||
|
|
||||||
|
// Récupération du mode proxy
|
||||||
|
$PROXYactivate = $this->em->getRepository("CadolesCoreBundle:Config")->findOneBy(["id"=>"PROXYactivate"])->getValue();
|
||||||
|
|
||||||
|
|
||||||
|
// En mode proxy on tente la connection via le proxy
|
||||||
|
if($PROXYactivate) {
|
||||||
$client = new SimpleCalDAVClient();
|
$client = new SimpleCalDAVClient();
|
||||||
try {
|
try {
|
||||||
if($PROXYactivate)
|
|
||||||
@$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['proxy_host'=>$PROXYserver.":".$PROXYport,'timeout'=>5]);
|
@$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['proxy_host'=>$PROXYserver.":".$PROXYport,'timeout'=>5]);
|
||||||
else
|
}
|
||||||
|
catch (CalDAVException $e) {
|
||||||
|
// Si KO on tente la meme connection mais sans le proxy
|
||||||
|
$PROXYactivate = false;
|
||||||
|
$this->writeln("Tentative de connection sans proxy");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$PROXYactivate) {
|
||||||
|
$client = new SimpleCalDAVClient();
|
||||||
|
try {
|
||||||
@$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['timeout'=>5]);
|
@$client->connect($calendar->getUrl(), $calendar->getLogin(), $calendar->getPasswordDecrypt(),['timeout'=>5]);
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (CalDAVException $e) {
|
||||||
dump($e->__toString());
|
$this->writelnred("");
|
||||||
|
$this->writelnred("KO = ".$e->getMessage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->writeln("Connected");
|
$this->writeln("Connected");
|
||||||
$this->writeln("");
|
|
||||||
$tbuid=array();
|
$tbuid=array();
|
||||||
$arrayOfCalendars = $client->findCalendars("afornerot");
|
$arrayOfCalendars = $client->findCalendars();
|
||||||
foreach($arrayOfCalendars as $calcalendar) {
|
foreach($arrayOfCalendars as $calcalendar) {
|
||||||
|
$this->writeln($calcalendar->getDisplayName());
|
||||||
if($calcalendar->getDisplayName()!=$calendar->getCaldavname()) continue;
|
if($calcalendar->getDisplayName()!=$calendar->getCaldavname()) continue;
|
||||||
|
|
||||||
$client->setCalendar($calcalendar);
|
$client->setCalendar($calcalendar);
|
||||||
|
|
Loading…
Reference in New Issue