protected function execute(InputInterface $input, OutputInterface $output) { // Check IP address input option. if (!$input->getOption('addr')) { $this->defaultHelp($output); return; } $logger = new OutputLogger($output); $rbmod = new RouterBoardMod($this->config, $logger); $iparse = new InputParser($this->config, $logger, $input->getOption('addr')); $action = $input->getArgument('action'); switch ($action) { case "addnew": $logger->log("Action: Add a new router/s to backup list."); $rsa = new SecureTools($this->config, $logger); $rsa->checkRSA(); $rbmod->addNewIP($iparse); break; case "delete": $logger->log("Action: Delete a router/s from backup list."); $rbmod->deleteIP($iparse); break; case "update": $logger->log("Action: Update a router ip address in backup list."); $rbmod->updateIP($iparse); break; default: $this->defaultHelp($output); break; } }
protected function execute(InputInterface $input, OutputInterface $output) { $logger = new OutputLogger($output); $rprint = new RouterBoardList($this->config, $logger); $action = $input->getArgument('action'); switch ($action) { case "list": $logger->log("Action: Print all routers from backup list."); $rprint->printAllRouterBoards(); break; default: $this->defaultHelp($output); break; } }
protected function execute(InputInterface $input, OutputInterface $output) { $logger = new OutputLogger($output); $rbackup = new RouterBoardBackup($this->config, $logger); $action = $input->getArgument('action'); switch ($action) { case "backup": if (!$input->getOption('addr')) { $logger->log("Action: Backup all routers from backup list."); $rbackup->backupAllRouterBoards(); break; } $logger->log("Action: Backup one or more routers from input."); $rbackup->backupOneRouterBoard(new InputParser($this->config, $logger, $input->getOption('addr'))); break; default: $this->defaultHelp($output); break; } }
protected function execute(InputInterface $input, OutputInterface $output) { $logger = new OutputLogger($output); $gitlab = new RouterBoardGitLab($this->config, $logger); $action = $input->getArgument('action'); switch ($action) { case "backup": if (!$input->getOption('addr')) { $logger->log("Action: Backup all routers from backup list to GitLab."); $gitlab->backupAllRouterBoards(); break; } $logger->log("Action: Backup one or more routers from input to GitLab."); $gitlab->backupOneRouterBoard(new InputParser($this->config, $logger, $input->getOption('addr'))); break; default: $command = $this->getApplication()->get('help'); $command->run(new ArrayInput(['command_name' => $this->getName()]), $output); break; } }
protected function execute(InputInterface $input, OutputInterface $output) { $logger = new OutputLogger($output); $logger->log("Start bind manager."); $action = $input->getArgument('action'); $bind = new BindManager($this->config, $logger); switch ($action) { case "restart": $bind->restartBind(); break; case "update": $bind->updateBind(); break; case "statistics": $bind->createBindStatistics(); break; default: $command = $this->getApplication()->get('help'); $command->run(new ArrayInput(['command_name' => $this->getName()]), $output); break; } }
public function testLoggerNotice() { $logger = new OutputLogger(new NullOutput()); $this->assertEmpty($logger->log("Test", $logger->setNotice())); }