PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.5.11
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.5.11
9.5.11 9.5.10.1 9.5.10 trunk 9.4.0 9.4.1 9.4.2 9.4.3 9.5.0 9.5.0.1 9.5.0.2 9.5.1 9.5.2 9.5.2.2 9.5.2.3 9.5.3 9.5.3.1 9.5.3.2 9.5.4 9.5.5 9.5.6 9.5.7 9.5.8 9.5.9
really-simple-ssl / lets-encrypt / cron.php
really-simple-ssl / lets-encrypt Last commit date
config 4 weeks ago integrations 4 weeks ago vendor 4 weeks ago class-le-restapi.php 4 weeks ago class-letsencrypt-handler.php 4 weeks ago composer.json 4 weeks ago cron.php 4 weeks ago download.php 4 weeks ago functions.php 4 weeks ago index.php 4 weeks ago letsencrypt.php 4 weeks ago
cron.php
60 lines
1 <?php
2 defined( 'ABSPATH' ) or die();
3
4 add_action( 'plugins_loaded', 'rsssl_le_schedule_cron' );
5 function rsssl_le_schedule_cron() {
6 //only run if SSL is enabled.
7 if ( !rsssl_get_option('ssl_enabled') ) {
8 return;
9 }
10
11 //only if generated by RSSSL.
12 if ( ! get_option( 'rsssl_le_certificate_generated_by_rsssl' ) ) {
13 return;
14 }
15
16 add_action( 'rsssl_week_cron', 'rsssl_le_cron_maybe_start_renewal' );
17 add_action( 'rsssl_daily_cron', 'rsssl_le_check_renewal_status' );
18 }
19
20 /**
21 * Check if the certificate is generated by RSSSL. If so, renew if necessary
22 */
23 function rsssl_le_cron_maybe_start_renewal(){
24 if ( !rsssl_generated_by_rsssl() ) {
25 return;
26 }
27
28 if ( RSSSL_LE()->letsencrypt_handler->cron_certificate_needs_renewal() ) {
29 update_option("rsssl_le_start_renewal", true, false);
30 }
31
32 if ( RSSSL_LE()->letsencrypt_handler->certificate_install_required() ) {
33 update_option("rsssl_le_start_installation", true, false);
34 }
35 }
36
37 function rsssl_le_check_renewal_status(){
38 if ( !rsssl_generated_by_rsssl() ) {
39 return;
40 }
41
42 //when DNS validated, without api, we cannot autorenew
43 if ( !RSSSL_LE()->letsencrypt_handler->ssl_generation_can_auto_renew() ) {
44 return;
45 }
46
47 $renewal_active = get_option("rsssl_le_start_renewal");
48 $installation_active = get_option("rsssl_le_start_installation");
49
50 if ( $renewal_active ) {
51 RSSSL_LE()->letsencrypt_handler->create_bundle_or_renew();
52 } else if ( $installation_active ) {
53 RSSSL_LE()->letsencrypt_handler->cron_renew_installation();
54 }
55 }
56
57
58
59
60