Version Description
Download this release
Release Info
Developer | johnbillion |
Plugin | WP Crontrol |
Version | 1.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.6.1 to 1.6.2
- readme.txt +1 -1
- wp-crontrol.php +31 -15
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: johnbillion, scompt
|
|
3 |
Tags: admin, cron, plugin, control, wp-cron, crontrol
|
4 |
Requires at least: 4.1
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 1.6.
|
7 |
|
8 |
WP Crontrol lets you view and control what's happening in the WP-Cron system.
|
9 |
|
3 |
Tags: admin, cron, plugin, control, wp-cron, crontrol
|
4 |
Requires at least: 4.1
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 1.6.2
|
7 |
|
8 |
WP Crontrol lets you view and control what's happening in the WP-Cron system.
|
9 |
|
wp-crontrol.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: WP Crontrol lets you view and control what's happening in the WP-Cron system.
|
6 |
* Author: John Blackbourn & contributors
|
7 |
* Author URI: https://github.com/johnbillion/wp-crontrol/graphs/contributors
|
8 |
-
* Version: 1.6.
|
9 |
* Text Domain: wp-crontrol
|
10 |
* Domain Path: /languages/
|
11 |
* License: GPL v2 or later
|
@@ -86,11 +86,11 @@ class Crontrol {
|
|
86 |
if ( ! current_user_can( 'manage_options' ) ) {
|
87 |
wp_die( esc_html__( 'You are not allowed to add new cron events.', 'wp-crontrol' ) );
|
88 |
}
|
|
|
|
|
89 |
if ( 'crontrol_cron_job' === $in_hookname && ! current_user_can( 'edit_files' ) ) {
|
90 |
wp_die( esc_html__( 'You are not allowed to add new PHP cron events.', 'wp-crontrol' ) );
|
91 |
}
|
92 |
-
check_admin_referer( 'new-cron' );
|
93 |
-
extract( wp_unslash( $_POST ), EXTR_PREFIX_ALL, 'in' );
|
94 |
$in_args = json_decode( $in_args, true );
|
95 |
$next_run = $in_next_run_date . ' ' . $in_next_run_time;
|
96 |
$this->add_cron( $next_run, $in_schedule, $in_hookname, $in_args );
|
@@ -130,6 +130,11 @@ class Crontrol {
|
|
130 |
|
131 |
extract( wp_unslash( $_POST ), EXTR_PREFIX_ALL, 'in' );
|
132 |
check_admin_referer( "edit-cron_{$in_original_hookname}_{$in_original_sig}_{$in_original_next_run}" );
|
|
|
|
|
|
|
|
|
|
|
133 |
$in_args = json_decode( $in_args, true );
|
134 |
$i = $this->delete_cron( $in_original_hookname, $in_original_sig, $in_original_next_run );
|
135 |
$next_run = $in_next_run_date . ' ' . $in_next_run_time;
|
@@ -144,7 +149,7 @@ class Crontrol {
|
|
144 |
|
145 |
} elseif ( isset( $_POST['edit_php_cron'] ) ) {
|
146 |
if ( ! current_user_can( 'edit_files' ) ) {
|
147 |
-
wp_die( esc_html__( 'You are not allowed to edit cron events.', 'wp-crontrol' ) );
|
148 |
}
|
149 |
|
150 |
extract( wp_unslash( $_POST ), EXTR_PREFIX_ALL, 'in' );
|
@@ -240,6 +245,9 @@ class Crontrol {
|
|
240 |
|
241 |
foreach ( $delete as $next_run => $events ) {
|
242 |
foreach ( $events as $id => $sig ) {
|
|
|
|
|
|
|
243 |
if ( $this->delete_cron( urldecode( $id ), $sig, $next_run ) ) {
|
244 |
$deleted++;
|
245 |
}
|
@@ -262,6 +270,11 @@ class Crontrol {
|
|
262 |
$sig = wp_unslash( $_GET['sig'] );
|
263 |
$next_run = intval( $_GET['next_run'] );
|
264 |
check_admin_referer( "delete-cron_{$id}_{$sig}_{$next_run}" );
|
|
|
|
|
|
|
|
|
|
|
265 |
if ( $this->delete_cron( $id, $sig, $next_run ) ) {
|
266 |
$redirect = array(
|
267 |
'page' => 'crontrol_admin_manage_page',
|
@@ -909,7 +922,7 @@ class Crontrol {
|
|
909 |
</form>
|
910 |
<?php } else { ?>
|
911 |
<div class="error inline">
|
912 |
-
<p><?php esc_html_e( 'You cannot add or
|
913 |
</div>
|
914 |
<?php } ?>
|
915 |
</div>
|
@@ -979,6 +992,7 @@ class Crontrol {
|
|
979 |
$events = $this->get_cron_events();
|
980 |
$doing_edit = ( isset( $_GET['action'] ) && 'edit-cron' === $_GET['action'] ) ? wp_unslash( $_GET['id'] ) : false ;
|
981 |
$time_format = 'Y-m-d H:i:s';
|
|
|
982 |
|
983 |
$core_hooks = array(
|
984 |
'wp_version_check',
|
@@ -1095,15 +1109,17 @@ class Crontrol {
|
|
1095 |
|
1096 |
echo '<td style="white-space:nowrap"><span class="row-actions visible">';
|
1097 |
|
1098 |
-
$
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
|
|
|
|
1107 |
|
1108 |
$link = array(
|
1109 |
'page' => 'crontrol_admin_manage_page',
|
@@ -1116,7 +1132,7 @@ class Crontrol {
|
|
1116 |
$link = wp_nonce_url( $link, "run-cron_{$event->hook}_{$event->sig}" );
|
1117 |
$links[] = "<a href='" . esc_url( $link ) . "'>" . esc_html__( 'Run Now', 'wp-crontrol' ) . '</a>';
|
1118 |
|
1119 |
-
if ( ! in_array( $event->hook, $core_hooks, true ) ) {
|
1120 |
$link = array(
|
1121 |
'page' => 'crontrol_admin_manage_page',
|
1122 |
'action' => 'delete-cron',
|
5 |
* Description: WP Crontrol lets you view and control what's happening in the WP-Cron system.
|
6 |
* Author: John Blackbourn & contributors
|
7 |
* Author URI: https://github.com/johnbillion/wp-crontrol/graphs/contributors
|
8 |
+
* Version: 1.6.2
|
9 |
* Text Domain: wp-crontrol
|
10 |
* Domain Path: /languages/
|
11 |
* License: GPL v2 or later
|
86 |
if ( ! current_user_can( 'manage_options' ) ) {
|
87 |
wp_die( esc_html__( 'You are not allowed to add new cron events.', 'wp-crontrol' ) );
|
88 |
}
|
89 |
+
check_admin_referer( 'new-cron' );
|
90 |
+
extract( wp_unslash( $_POST ), EXTR_PREFIX_ALL, 'in' );
|
91 |
if ( 'crontrol_cron_job' === $in_hookname && ! current_user_can( 'edit_files' ) ) {
|
92 |
wp_die( esc_html__( 'You are not allowed to add new PHP cron events.', 'wp-crontrol' ) );
|
93 |
}
|
|
|
|
|
94 |
$in_args = json_decode( $in_args, true );
|
95 |
$next_run = $in_next_run_date . ' ' . $in_next_run_time;
|
96 |
$this->add_cron( $next_run, $in_schedule, $in_hookname, $in_args );
|
130 |
|
131 |
extract( wp_unslash( $_POST ), EXTR_PREFIX_ALL, 'in' );
|
132 |
check_admin_referer( "edit-cron_{$in_original_hookname}_{$in_original_sig}_{$in_original_next_run}" );
|
133 |
+
|
134 |
+
if ( 'crontrol_cron_job' === $in_hookname && ! current_user_can( 'edit_files' ) ) {
|
135 |
+
wp_die( esc_html__( 'You are not allowed to edit PHP cron events.', 'wp-crontrol' ) );
|
136 |
+
}
|
137 |
+
|
138 |
$in_args = json_decode( $in_args, true );
|
139 |
$i = $this->delete_cron( $in_original_hookname, $in_original_sig, $in_original_next_run );
|
140 |
$next_run = $in_next_run_date . ' ' . $in_next_run_time;
|
149 |
|
150 |
} elseif ( isset( $_POST['edit_php_cron'] ) ) {
|
151 |
if ( ! current_user_can( 'edit_files' ) ) {
|
152 |
+
wp_die( esc_html__( 'You are not allowed to edit PHP cron events.', 'wp-crontrol' ) );
|
153 |
}
|
154 |
|
155 |
extract( wp_unslash( $_POST ), EXTR_PREFIX_ALL, 'in' );
|
245 |
|
246 |
foreach ( $delete as $next_run => $events ) {
|
247 |
foreach ( $events as $id => $sig ) {
|
248 |
+
if ( 'crontrol_cron_job' === $id && ! current_user_can( 'edit_files' ) ) {
|
249 |
+
continue;
|
250 |
+
}
|
251 |
if ( $this->delete_cron( urldecode( $id ), $sig, $next_run ) ) {
|
252 |
$deleted++;
|
253 |
}
|
270 |
$sig = wp_unslash( $_GET['sig'] );
|
271 |
$next_run = intval( $_GET['next_run'] );
|
272 |
check_admin_referer( "delete-cron_{$id}_{$sig}_{$next_run}" );
|
273 |
+
|
274 |
+
if ( 'crontrol_cron_job' === $id && ! current_user_can( 'edit_files' ) ) {
|
275 |
+
wp_die( esc_html__( 'You are not allowed to delete PHP cron events.', 'wp-crontrol' ) );
|
276 |
+
}
|
277 |
+
|
278 |
if ( $this->delete_cron( $id, $sig, $next_run ) ) {
|
279 |
$redirect = array(
|
280 |
'page' => 'crontrol_admin_manage_page',
|
922 |
</form>
|
923 |
<?php } else { ?>
|
924 |
<div class="error inline">
|
925 |
+
<p><?php esc_html_e( 'You cannot add, edit, or delete PHP cron events because your user account does not have the ability to edit files.', 'wp-crontrol' ); ?></p>
|
926 |
</div>
|
927 |
<?php } ?>
|
928 |
</div>
|
992 |
$events = $this->get_cron_events();
|
993 |
$doing_edit = ( isset( $_GET['action'] ) && 'edit-cron' === $_GET['action'] ) ? wp_unslash( $_GET['id'] ) : false ;
|
994 |
$time_format = 'Y-m-d H:i:s';
|
995 |
+
$can_edit_files = current_user_can( 'edit_files' );
|
996 |
|
997 |
$core_hooks = array(
|
998 |
'wp_version_check',
|
1109 |
|
1110 |
echo '<td style="white-space:nowrap"><span class="row-actions visible">';
|
1111 |
|
1112 |
+
if ( ( 'crontrol_cron_job' !== $event->hook ) || $can_edit_files ) {
|
1113 |
+
$link = array(
|
1114 |
+
'page' => 'crontrol_admin_manage_page',
|
1115 |
+
'action' => 'edit-cron',
|
1116 |
+
'id' => rawurlencode( $event->hook ),
|
1117 |
+
'sig' => rawurlencode( $event->sig ),
|
1118 |
+
'next_run' => rawurlencode( $event->time ),
|
1119 |
+
);
|
1120 |
+
$link = add_query_arg( $link, admin_url( 'tools.php' ) ) . '#crontrol_form';
|
1121 |
+
$links[] = "<a href='" . esc_url( $link ) . "'>" . esc_html__( 'Edit', 'wp-crontrol' ) . '</a>';
|
1122 |
+
}
|
1123 |
|
1124 |
$link = array(
|
1125 |
'page' => 'crontrol_admin_manage_page',
|
1132 |
$link = wp_nonce_url( $link, "run-cron_{$event->hook}_{$event->sig}" );
|
1133 |
$links[] = "<a href='" . esc_url( $link ) . "'>" . esc_html__( 'Run Now', 'wp-crontrol' ) . '</a>';
|
1134 |
|
1135 |
+
if ( ! in_array( $event->hook, $core_hooks, true ) && ( ( 'crontrol_cron_job' !== $event->hook ) || $can_edit_files ) ) {
|
1136 |
$link = array(
|
1137 |
'page' => 'crontrol_admin_manage_page',
|
1138 |
'action' => 'delete-cron',
|