private function simpleAction($action = 'renew') { $fs = new Filesystem(); if (!$fs->exists($this->config['system']['le-domains'])) { throw new Exception("FATAL ERROR: Directory " . $this->config['system']['le-domains'] . " not exist. Is Let's Encrypt installed ?"); } $check = new domainCheck(); $finder = new Finder(); $certCheck = new certsCheck(); $le = new letsEncrypt($this->config); $counter = 0; $finder->directories()->in($this->config['system']['le-domains']); foreach ($finder as $file) { if ($certCheck->isCertExpire($file->getRealpath())) { if ($check->isSubdomain($file->getRelativePathname())) { if ($action == 'renew') { $le->renewSubDomain($file->getRelativePathname()); } elseif ($action == 'revoke') { $le->revokeSubDomain($file->getRelativePathname()); } } else { if ($action == 'renew') { $le->renewDomain($file->getRelativePathname()); } elseif ($action == 'revoke') { $le->revokeDomain($file->getRelativePathname()); } } $counter++; } } return $counter; }
private function simpleActionOne($action, $domain, $time) { if ($this->checkLetsEncrypt()) { $check = new domainCheck(); $certCheck = new certsCheck(); $le = new letsEncrypt($this->config); if ($this->fs->exists($this->config['system']['le-domains'] . DIRECTORY_SEPARATOR . $domain)) { if ($action == 'renew') { if ($certCheck->isCertExpire($this->config['system']['le-domains'] . DIRECTORY_SEPARATOR . $domain, $time)) { if ($check->isSubdomain($domain)) { $le->renewSubDomain($domain); } else { $le->renewDomain($domain); } } } elseif ($action == 'revoke') { $le->revokeDomain($domain); } } else { throw new Exception("FATAL ERROR: Directory " . $this->config['system']['le-domains'] . DIRECTORY_SEPARATOR . $domain . " not exist."); } } }