Beispiel #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     //         $start = intval($input->getOption('start'));
     //         $stop  = intval($input->getOption('stop'));
     $dnsCommand = $this->getApplication()->find('synknot:dns');
     $dnsCommand->run($input, $output);
     $ptrCommand = $this->getApplication()->find('synknot:ptr');
     $ptrCommand->run($input, $output);
     $fileBuilder = new FileBuilder($this->config);
     if (is_dir($this->config['path-timers'])) {
         $fileBuilder->clearDirectory($this->config['path-timers'], array('*.mdb'));
     }
     //přesun nových záznamů
     $fileBuilder->clearDirectory($this->config['path-pri-backup']);
     $fileBuilder->moveDirectory($this->config['path-pri'], $this->config['path-pri-backup']);
     $fileBuilder->moveDirectory($this->config['path-pri-tmp'], $this->config['path-pri']);
     //přesun seznamu zónových souborů
     $fileBuilder->moveFile($this->config['path-zones'], $this->config['path-zones-backup']);
     $fileBuilder->moveFile($this->config['path-zones-tmp'], $this->config['path-zones']);
     $fileBuilder = new FileBuilder($this->config);
     //přesun nových záznamů
     $fileBuilder->clearDirectory($this->config['path-ptr-backup']);
     $fileBuilder->moveDirectory($this->config['path-ptr'], $this->config['path-ptr-backup']);
     $fileBuilder->moveDirectory($this->config['path-ptr-tmp'], $this->config['path-ptr']);
     //přesun seznamu zónových souborů
     $fileBuilder->moveFile($this->config['path-zones-ptr'], $this->config['path-zones-ptr-backup']);
     $fileBuilder->moveFile($this->config['path-zones-ptr-tmp'], $this->config['path-zones-ptr']);
     //restart
     $dnsSynchronizer = new DNSSynchronizer($this->config);
     $dnsSynchronizer->restartService();
     $output->writeln('Restarting service.');
 }
Beispiel #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     //         $start = intval($input->getOption('start'));
     //         $stop  = intval($input->getOption('stop'));
     //     	sleep(10);
     //     	throw new SynKnotException("chybka");
     //     	var_dump("executing reload");
     //nasype DNS (pri) zóny do temp adresáře
     $dnsCommand = $this->getApplication()->find('synknot:dns');
     $dnsCommand->run($input, $output);
     //nasype PTR zóny do tmp adresáře
     $ptrCommand = $this->getApplication()->find('synknot:ptr');
     $ptrCommand->run($input, $output);
     $fileBuilder = new FileBuilder($this->config);
     //přesun nových záznamů
     //temp do používaného adresáře
     $fileBuilder->moveDirectory($this->config['path-pri-tmp'], $this->config['path-pri']);
     //přesun seznamu zónových souborů
     $fileBuilder->moveFile($this->config['path-zones-tmp'], $this->config['path-zones']);
     //pro PTR to platí taky
     $fileBuilder->moveDirectory($this->config['path-ptr-tmp'], $this->config['path-ptr']);
     $fileBuilder->moveFile($this->config['path-zones-ptr-tmp'], $this->config['path-zones-ptr']);
     //reload
     $dnsSynchronizer = new DNSSynchronizer($this->config);
     $dnsSynchronizer->reloadService();
     $output->writeln('Reloading service.');
     //TODO
     //$this->getContainer()->get('logger')->info("Reload complete");
     //         $this->logger->info()
 }
Beispiel #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     //         $move = $input->getOption('move');
     //         $stop  = intval($input->getOption('stop'));
     //		try{
     $outputInterfaceLogger = new OutputInterfaceLogger($output);
     $dnsSynchronizer = new DNSSynchronizer($this->config);
     $dnsSynchronizer->setLogger($outputInterfaceLogger);
     $ptrDataAdapter = $this->config["data-adapter.ptr-records"];
     $dnsSynchronizer->createPTRRecords(new $ptrDataAdapter($this->config));
     //		}catch (SynKnotException $e){
     //         	echo $e->getMessage();
     //         }catch (Exception $e){
     //         	echo $e->getMessage();
     //         }
     // 		if($move){
     // 		}
     // 		$fileBuilder = new FileBuilder($this->config);
     //přesun nových záznamů
     // 		$fileBuilder->clearDirectory($this->config['path-ptr-backup']);
     // 		$fileBuilder->moveDirectory($this->config['path-ptr'], $this->config['path-ptr-backup']);
     // 		$fileBuilder->moveDirectory($this->config['path-ptr-tmp'], $this->config['path-ptr']);
     //přesun seznamu zónových souborů
     // 		$fileBuilder->saveContent($ptrBuilder->getZoneList(), $this->config['path-zones-ptr-tmp']);
     // 		$fileBuilder->moveFile($this->config['path-zones-ptr'], $this->config['path-zones-ptr-backup']);
     // 		$fileBuilder->moveFile($this->config['path-zones-ptr-tmp'], $this->config['path-zones-ptr']);
     $output->writeln('PTR records has been synchronized.');
 }
Beispiel #4
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     //         $start = intval($input->getOption('start'));
     $dnsSynchronizer = new DNSSynchronizer($this->config);
     //     	$dnsSynchronizer->createPTRRecords(new BestHostingPTRAdapter($this->config));
     // var_dump($this->config);
     $dnsRecordsAdapter = $this->config["data-adapter.dns-records"];
     $dnsSynchronizer->createDNSRecords(new $dnsRecordsAdapter($this->config));
     //TODO načítat z konfigurace
     //     	$fileBuilder = new FileBuilder($this->config);
     //     	//přesun nových záznamů
     //     	$fileBuilder->clearDirectory($this->config['path-pri-backup']);
     //     	$fileBuilder->moveDirectory($this->config['path-pri'], $this->config['path-pri-backup']);
     //     	$fileBuilder->moveDirectory($this->config['path-pri-tmp'], $this->config['path-pri']);
     //     	//přesun seznamu zónových souborů
     //     	//         $fileBuilder->saveContent($dnsBuilder->getZoneList(), $this->config['path-zones-tmp']);
     //     	$fileBuilder->moveFile($this->config['path-zones'], $this->config['path-zones-backup']);
     //     	$fileBuilder->moveFile($this->config['path-zones-tmp'], $this->config['path-zones']);
     $output->writeln('DNS records has been synchronized.');
 }