/** * Revokes a certificate with Let's Encrypt. * * This method is called through one of the action callbacks. * * @since 1.0.0 * @access protected * * @param array $data The request data for the action. * @param bool $network_wide Whether this action should be performed network-wide. * @return string|WP_Error The success message or an error object. */ protected function revoke_certificate($data = array(), $network_wide = false) { $filesystem_check = $this->maybe_request_filesystem_credentials($network_wide); if (false === $filesystem_check) { return new WP_Error('invalid_filesystem_credentials', __('Invalid or missing filesystem credentials.', 'wp-encrypt'), 'error'); } $domain = $network_wide ? Util::get_network_domain() : Util::get_site_domain(); $manager = CertificateManager::get(); $response = $manager->revoke_certificate($domain); if (is_wp_error($response)) { return $response; } Util::delete_registration_info('certificate'); if (Util::get_option('autogenerate_certificate')) { Util::unschedule_autogenerate_event(); } return __('Certificate revoked.', 'wp-encrypt'); }
/** * Returns an array of directories for the certificates and keys for a domain. * * @since 1.0.0 * @access protected * * @param string $domain The domain to get the directories for. * @return array An array containing 'base', 'cert', 'chain', 'fullchain' and 'key' keys with their respective directory as value. */ protected function get_certificate_dirs($domain) { $site_domain = 'network' === $this->context ? Util::get_network_domain() : Util::get_site_domain(); $certificate_dirs = array('base' => CoreUtil::get_letsencrypt_certificates_dir_path() . '/' . $domain); $certificate_dirs['cert'] = $certificate_dirs['base'] . '/' . Certificate::CERT_NAME; $certificate_dirs['chain'] = $certificate_dirs['base'] . '/' . Certificate::CHAIN_NAME; $certificate_dirs['fullchain'] = $certificate_dirs['base'] . '/' . Certificate::FULLCHAIN_NAME; $certificate_dirs['key'] = $certificate_dirs['base'] . '/' . KeyPair::PRIVATE_NAME; return $certificate_dirs; }