protected function execute(InputInterface $input, OutputInterface $output)
 {
     $action = $input->getOption('action');
     switch ($action) {
         // RENEW Certificate/s if expire during 24 hour
         case 'renew':
             $renew = new WatchdogSimple($this->config);
             if ($input->getOption('domain') == "all") {
                 $renew->renewAllDomain();
             } else {
                 echo "Only ALL in this time, sory." . PHP_EOL;
             }
             break;
             // REVOKE Certificate/s
         // REVOKE Certificate/s
         case 'revoke':
             echo "Only renew in this time, sory." . PHP_EOL;
             break;
         default:
             echo '?? Nothing to do.' . PHP_EOL;
             break;
     }
 }
Exemplo n.º 2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $action = $input->getOption('action');
     if (!is_numeric($input->getOption('time'))) {
         throw new Exception("FATAL ERROR: Input parametr time is not a number!");
     }
     if ($input->getOption('time') < 86400) {
         throw new Exception("FATAL ERROR: Input parametr time is too small!");
     }
     $wd = new WatchdogSimple($this->config);
     switch ($action) {
         // RENEW
         case 'renew':
             if ($input->getOption('domain') == "all") {
                 if ($x = $wd->renewAllDomain($input->getOption('time')) > 0) {
                     echo PHP_EOL . "Renew: " . $x . " certificate/s." . PHP_EOL;
                 }
             } else {
                 $wd->renewOneDomain($input->getOption('domain'), $input->getOption('time'));
             }
             break;
             // REVOKE
         // REVOKE
         case 'revoke':
             if ($input->getOption('domain') == "all") {
                 if ($x = $wd->revokeAllDomain() > 0) {
                     echo PHP_EOL . "Revoke: " . $x . " certificate/s." . PHP_EOL;
                 }
             } else {
                 $wd->revokeOneDomain($input->getOption('domain'));
             }
             break;
         default:
             echo '?? Nothing to do.' . PHP_EOL;
             break;
     }
 }