WP Crontrol - Version 1.8.4

Version Description

Download this release

Release Info

Developer johnbillion
Plugin Icon 128x128 WP Crontrol
Version 1.8.4
Comparing to
See all releases

Code changes from version 1.8.3 to 1.8.4

Files changed (2) hide show
  1. readme.md +12 -3
  2. wp-crontrol.php +53 -5
readme.md CHANGED
@@ -4,7 +4,7 @@ Contributors: johnbillion, scompt
4
  Tags: cron, wp-cron, crontrol, debug
5
  Requires at least: 4.1
6
  Tested up to: 5.4
7
- Stable tag: 1.8.3
8
  Requires PHP: 5.3
9
 
10
  WP Crontrol lets you view and control what's happening in the WP-Cron system.
@@ -60,9 +60,13 @@ The next step is to write your function. Here's a simple example:
60
 
61
  Only users with the `manage_options` capability can manage cron events and schedules. By default, only Administrators have this capability.
62
 
63
- ### Which users can manage PHP cron events? ###
64
 
65
- Only users with the `edit_files` capability can manage PHP cron events. By default, only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.
 
 
 
 
66
 
67
  ### Are any WP-CLI commands available? ###
68
 
@@ -76,6 +80,11 @@ The cron commands which were previously included in WP Crontrol are now part of
76
 
77
  ## Changelog ##
78
 
 
 
 
 
 
79
  ### 1.8.3 ###
80
 
81
  * Fix the editing of events that aren't currently listed on the first page of results.
4
  Tags: cron, wp-cron, crontrol, debug
5
  Requires at least: 4.1
6
  Tested up to: 5.4
7
+ Stable tag: 1.8.4
8
  Requires PHP: 5.3
9
 
10
  WP Crontrol lets you view and control what's happening in the WP-Cron system.
60
 
61
  Only users with the `manage_options` capability can manage cron events and schedules. By default, only Administrators have this capability.
62
 
63
+ ### Which users can manage PHP cron events? Is this dangerous? ###
64
 
65
+ Only users with the `edit_files` capability can manage PHP cron events. This means if a user cannot edit files on the site (eg. through the Plugin Editor or Theme Editor) then they cannot edit or add a PHP cron event. By default, only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.
66
+
67
+ If file editing has been disabled via the `DISALLOW_FILE_MODS` or `DISALLOW_FILE_EDIT` configuration constants then no user will have the `edit_files` capability, which means editing or adding a PHP cron event will not be permitted.
68
+
69
+ Therefore, the user access level required to execute arbitrary PHP code does not change with WP Crontrol activated.
70
 
71
  ### Are any WP-CLI commands available? ###
72
 
80
 
81
  ## Changelog ##
82
 
83
+ ### 1.8.4 ###
84
+
85
+ * Add a warning message if the default timezone has been changed. More information: https://github.com/johnbillion/wp-crontrol/wiki/PHP-default-timezone-is-not-set-to-UTC
86
+ * Fixed string being passed to `strtotime()` function when the `Now` option is chosen when adding or editing an event.
87
+
88
  ### 1.8.3 ###
89
 
90
  * Fix the editing of events that aren't currently listed on the first page of results.
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 & crontributors
7
  * Author URI: https://github.com/johnbillion/wp-crontrol/graphs/contributors
8
- * Version: 1.8.3
9
  * Text Domain: wp-crontrol
10
  * Domain Path: /languages/
11
  * Requires PHP: 5.3.6
@@ -644,10 +644,54 @@ function test_cron_spawn( $cache = true ) {
644
 
645
  }
646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
647
  /**
648
  * Shows the status of WP-Cron functionality on the site. Only displays a message when there's a problem.
 
 
649
  */
650
- function show_cron_status() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
651
  $status = test_cron_spawn();
652
 
653
  if ( is_wp_error( $status ) ) {
@@ -898,7 +942,7 @@ function show_cron_form( $editing, $is_php = null ) {
898
  <ul>
899
  <li>
900
  <label>
901
- <input type="radio" name="next_run_date_local" value="now()" checked>
902
  <?php esc_html_e( 'Now', 'wp-crontrol' ); ?>
903
  </label>
904
  </li>
@@ -1520,8 +1564,12 @@ function json_output( $input ) {
1520
  /**
1521
  * Evaluates the code in a PHP cron event using eval.
1522
  *
1523
- * Security: A user can only add or edit a PHP cron event if they have the `edit_files` capability. This means if a user
1524
- * cannot edit files on the site (eg. through the plugin or theme editor) then they cannot edit or add a PHP cron event.
 
 
 
 
1525
  *
1526
  * Therefore, the user access level required to execute arbitrary PHP code does not change with WP Crontrol activated.
1527
  *
5
  * Description: WP Crontrol lets you view and control what's happening in the WP-Cron system.
6
  * Author: John Blackbourn & crontributors
7
  * Author URI: https://github.com/johnbillion/wp-crontrol/graphs/contributors
8
+ * Version: 1.8.4
9
  * Text Domain: wp-crontrol
10
  * Domain Path: /languages/
11
  * Requires PHP: 5.3.6
644
 
645
  }
646
 
647
+ /**
648
+ * Determines whether the given feature is enabled.
649
+ *
650
+ * The feature directly corresponds to one of WP Crontrol's tabs. Currently the only feature
651
+ * that's not enabled by default is "logs" which are provided by WP Crontrol Pro.
652
+ *
653
+ * @param string $feature The feature name.
654
+ * @return bool Whether the specified tab is active.
655
+ */
656
+ function is_feature_enabled( $feature ) {
657
+ $enabled = ( 'logs' !== $feature );
658
+ return apply_filters( "crontrol/enabled/{$feature}", $enabled );
659
+ }
660
+
661
  /**
662
  * Shows the status of WP-Cron functionality on the site. Only displays a message when there's a problem.
663
+ *
664
+ * @param string $tab The tab name.
665
  */
666
+ function show_cron_status( $tab ) {
667
+ if ( ! is_feature_enabled( $tab ) ) {
668
+ return;
669
+ }
670
+
671
+ if ( 'UTC' !== date_default_timezone_get() ) {
672
+ $string = sprintf(
673
+ /* translators: %s: Help page URL. */
674
+ __( 'PHP default timezone is not set to UTC. This may cause issues with cron event timings. <a href="%s">More information</a>.', 'wp-crontrol' ),
675
+ 'https://github.com/johnbillion/wp-crontrol/wiki/PHP-default-timezone-is-not-set-to-UTC'
676
+ );
677
+ ?>
678
+ <div id="crontrol-timezone-warning" class="notice notice-warning">
679
+ <p>
680
+ <?php
681
+ echo wp_kses(
682
+ $string,
683
+ array(
684
+ 'a' => array(
685
+ 'href' => true,
686
+ ),
687
+ )
688
+ );
689
+ ?>
690
+ </p>
691
+ </div>
692
+ <?php
693
+ }
694
+
695
  $status = test_cron_spawn();
696
 
697
  if ( is_wp_error( $status ) ) {
942
  <ul>
943
  <li>
944
  <label>
945
+ <input type="radio" name="next_run_date_local" value="now" checked>
946
  <?php esc_html_e( 'Now', 'wp-crontrol' ); ?>
947
  </label>
948
  </li>
1564
  /**
1565
  * Evaluates the code in a PHP cron event using eval.
1566
  *
1567
+ * Security: Only users with the `edit_files` capability can manage PHP cron events. This means if a user cannot edit
1568
+ * files on the site (eg. through the Plugin Editor or Theme Editor) then they cannot edit or add a PHP cron event. By
1569
+ * default, only Administrators have this capability, and with Multisite enabled only Super Admins have this capability.
1570
+ *
1571
+ * If file editing has been disabled via the `DISALLOW_FILE_MODS` or `DISALLOW_FILE_EDIT` configuration constants then
1572
+ * no user will have the `edit_files` capability, which means editing or adding a PHP cron event will not be permitted.
1573
  *
1574
  * Therefore, the user access level required to execute arbitrary PHP code does not change with WP Crontrol activated.
1575
  *