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 / security / cron.php
really-simple-ssl / security Last commit date
includes 4 weeks ago server 4 weeks ago tests 4 weeks ago wordpress 4 weeks ago class-rsssl-htaccess-file-manager.php 4 weeks ago cron.php 4 weeks ago deactivate-integration.php 4 weeks ago firewall-manager.php 4 weeks ago functions.php 4 weeks ago index.php 4 weeks ago integrations.php 4 weeks ago notices.php 4 weeks ago security.php 4 weeks ago sync-settings.php 4 weeks ago tests.php 4 weeks ago
cron.php
150 lines
1 <?php
2 defined('ABSPATH') or die();
3
4 $autoloader = dirname(__FILE__) . '/../rsssl-auto-loader.php';
5 if (file_exists($autoloader)) {
6 require_once($autoloader);
7 }
8
9 /**
10 Schedule cron jobs if useCron is true
11 Else start the functions for testing
12 */
13 define('RSSSL_USE_CRON', true );
14 if ( RSSSL_USE_CRON ) {
15 add_action( 'plugins_loaded', 'rsssl_schedule_cron' );
16 function rsssl_schedule_cron() {
17 if ( ! wp_next_scheduled( 'rsssl_every_day_hook' ) ) {
18 wp_schedule_event( time(), 'rsssl_daily', 'rsssl_every_day_hook' );
19 }
20
21 if ( ! wp_next_scheduled( 'rsssl_every_three_hours_hook' ) ) {
22 wp_schedule_event( time(), 'rsssl_every_three_hours', 'rsssl_every_three_hours_hook' );
23 }
24
25 if ( ! wp_next_scheduled( 'rsssl_every_five_minutes_hook' ) ) {
26 wp_schedule_event( time(), 'rsssl_five_minutes', 'rsssl_every_five_minutes_hook' );
27 }
28 if ( ! wp_next_scheduled( 'rsssl_every_week_hook' ) ) {
29 wp_schedule_event( time(), 'rsssl_weekly', 'rsssl_every_week_hook' );
30 }
31 if ( ! wp_next_scheduled( 'rsssl_every_month_hook' ) ) {
32 wp_schedule_event( time(), 'rsssl_monthly', 'rsssl_every_month_hook' );
33 }
34 }
35 }
36 /**
37 * Fire three hours cron hook
38 * @return void
39 */
40 function rsssl_three_hours_cron(){
41 do_action('rsssl_three_hours_cron');
42 }
43 add_action( 'rsssl_every_three_hours_hook', 'rsssl_three_hours_cron' );
44
45 /**
46 * Fire daily cron hook
47 */
48 function rsssl_daily_cron(){
49 do_action('rsssl_daily_cron');
50 }
51 add_action( 'rsssl_every_day_hook', 'rsssl_daily_cron' );
52 /**
53 * Fire five minutes cron hook
54 */
55 function rsssl_five_minutes_cron() {
56 do_action( 'rsssl_five_minutes_cron' );
57 }
58 add_action( 'rsssl_every_five_minutes_hook', 'rsssl_five_minutes_cron' );
59 /**
60 * Fire weekly cron hook
61 */
62 function rsssl_weekly_cron() {
63 do_action( 'rsssl_weekly_cron' );
64 }
65 add_action( 'rsssl_every_week_hook', 'rsssl_weekly_cron' );
66 /**
67 * Fire montly cron hook
68 */
69 function rsssl_monthly_cron() {
70 do_action( 'rsssl_monthly_cron' );
71 }
72 add_action( 'rsssl_every_month_hook', 'rsssl_monthly_cron' );
73
74
75 /**
76 * For testing without cron enabled. Not recommended for production
77 */
78 if ( !RSSSL_USE_CRON ) {
79 add_action( 'admin_init', 'rsssl_schedule_non_cron' );
80 function rsssl_schedule_non_cron(){
81 do_action( 'rsssl_daily_cron' );
82 do_action( 'rsssl_five_minutes_cron' );
83 do_action('rsssl_week_cron');
84 do_action('rsssl_month_cron');
85 }
86 }
87 /**
88 * Add our schedules
89 * @param array $schedules
90 *
91 * @return array
92 */
93 function rsssl_filter_cron_schedules( $schedules ) {
94 $schedules['rsssl_five_minutes'] = array(
95 'interval' => 5 * MINUTE_IN_SECONDS, // seconds
96 'display' => __('Once every 5 minutes')
97 );
98 $schedules['rsssl_daily'] = array(
99 'interval' => DAY_IN_SECONDS,
100 'display' => __( 'Once every day' )
101 );
102 $schedules['rsssl_every_three_hours'] = array(
103 'interval' => 3 * HOUR_IN_SECONDS,
104 'display' => __( 'Every three hours' )
105 );
106 $schedules['rsssl_weekly'] = array(
107 'interval' => WEEK_IN_SECONDS,
108 'display' => __( 'Once every week' )
109 );
110 $schedules['rsssl_monthly'] = array(
111 'interval' => MONTH_IN_SECONDS,
112 'display' => __( 'Once every month' )
113 );
114 return $schedules;
115 }
116 add_filter( 'cron_schedules', 'rsssl_filter_cron_schedules' );
117 /**
118 * Clear on deactivation
119 *
120 * @return void
121 */
122 function rsssl_clear_scheduled_hooks() {
123 wp_clear_scheduled_hook( 'rsssl_every_day_hook' );
124 wp_clear_scheduled_hook( 'rsssl_every_week_hook' );
125 wp_clear_scheduled_hook( 'rsssl_every_month_hook' );
126 wp_clear_scheduled_hook( 'rsssl_every_five_minutes_hook' );
127 wp_clear_scheduled_hook( 'rsssl_every_three_hours_hook' );
128 wp_clear_scheduled_hook( 'rsssl_ssl_process_hook' );
129 }
130 register_deactivation_hook( rsssl_file, 'rsssl_clear_scheduled_hooks' );
131
132 /**
133 * Multisite cron
134 */
135
136 add_action('plugins_loaded', 'rsssl_multisite_schedule_cron', 15);
137 function rsssl_multisite_schedule_cron()
138 {
139 if ( get_site_option('rsssl_ssl_activation_active') ) {
140 if ( !wp_next_scheduled('rsssl_ssl_process_hook') ) {
141 wp_schedule_event(time(), 'rsssl_one_minute', 'rsssl_ssl_process_hook');
142 }
143 } else {
144 wp_clear_scheduled_hook('rsssl_ssl_process_hook');
145 }
146 add_action( 'rsssl_ssl_process_hook', array( RSSSL()->multisite, 'run_ssl_process' ) );
147 }
148
149
150