Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,26 @@ jobs:
# See the following for PHP compatibility of WordPress versions:
# https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/
matrix:
wp:
# Three most recent versions of WordPress
- '6.9'
- '6.8'
- '6.7'
php:
# Most recent version of PHP supported by all of the above, plus 7.4
- '8.4'
- '7.4'
include:
# Latest WordPress on latest PHP
# - wp: '6.9'
# php: '8.5'
# Oldest supported WordPress on its newest supported PHP, plus 7.4:
- wp: '6.4'
# Latest:
- wp: '7.0'
php: '8.5'
- wp: '7.0'
php: '7.4'
# Latest -1:
- wp: '6.9'
php: '8.5'
- wp: '6.9'
php: '7.4'
# Latest -2:
- wp: '6.8'
php: '8.4'
- wp: '6.8'
php: '7.4'
# Oldest supported:
- wp: '6.5'
php: '8.3'
- wp: '6.4'
- wp: '6.5'
php: '7.4'
fail-fast: false
uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@99fbf371962704dbaef452ebe7ea188d5cfb8069 # 2.9.4
Expand Down
29 changes: 16 additions & 13 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,26 @@ jobs:
# See the following for PHP compatibility of WordPress versions:
# https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/
matrix:
wp:
# Three most recent versions of WordPress
- '6.9'
- '6.8'
- '6.7'
php:
# Most recent version of PHP supported by all of the above, plus 7.4
- '8.4'
- '7.4'
include:
# Latest WordPress on latest PHP
# Latest:
- wp: '7.0'
php: '8.5'
- wp: '7.0'
php: '7.4'
# Latest -1:
- wp: '6.9'
php: '8.5'
# Oldest supported WordPress on its newest supported PHP, plus 7.4:
- wp: '6.4'
- wp: '6.9'
php: '7.4'
# Latest -2:
- wp: '6.8'
php: '8.4'
- wp: '6.8'
php: '7.4'
# Oldest supported:
- wp: '6.5'
php: '8.3'
- wp: '6.4'
- wp: '6.5'
php: '7.4'
fail-fast: false
with:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"require-dev": {
"johnbillion/plugin-infrastructure": "2.9.4",
"johnbillion/wp-compat": "1.4.0",
"php-stubs/wordpress-stubs": "6.9.0",
"php-stubs/wordpress-stubs": "7.0.0 as 6.9.4",
"phpcompatibility/phpcompatibility-wp": "2.1.8",
"phpstan/phpstan": "2.1.33",
"szepeviktor/phpstan-wordpress": "2.0.3",
Expand Down Expand Up @@ -78,7 +78,7 @@
"phpcbf -nps --colors --report-code --report-summary --report-width=80 --basepath=./ ."
],
"test:phpstan": [
"phpstan analyze -v --memory-limit=1024M"
"phpstan analyze -v --memory-limit=2G"
],
"test:start": [
"tests-start"
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ruleset name="WP Crontrol">

<config name="testVersion" value="7.4-"/>
<config name="minimum_wp_version" value="6.4"/>
<config name="minimum_wp_version" value="6.5"/>
<arg name="extensions" value="php"/>
<arg name="cache" value="tests/cache/phpcs.json"/>

Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Contributors: johnbillion, scompt
Tags: cron, wp-cron, crontrol, debug, woocommerce
Tested up to: 6.9
Tested up to: 7.0
Stable tag: 1.21.0
License: GPL v2 or later
Donate link: https://github.com/sponsors/johnbillion
Expand Down
150 changes: 87 additions & 63 deletions src/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1205,12 +1205,15 @@ function admin_options_page() {
$hook = wp_unslash( $_GET['crontrol_name'] );
$message = intval( $_GET['crontrol_message'] );

printf(
'<div id="crontrol-message" class="notice notice-%1$s is-dismissible"><p>%2$s</p></div>',
esc_attr( $messages[ $message ][1] ),
wp_admin_notice(
sprintf(
esc_html( $messages[ $message ][0] ),
'<strong>' . esc_html( $hook ) . '</strong>'
),
array(
'id' => 'crontrol-message',
'type' => $messages[ $message ][1],
'dismissible' => true,
)
);
}
Expand Down Expand Up @@ -1399,46 +1402,48 @@ function show_cron_status() {
}

if ( 'UTC' !== date_default_timezone_get() ) {
?>
<div id="crontrol-timezone-warning" class="notice notice-warning">
<?php
printf(
'<p>%1$s</p><p><a href="%2$s">%3$s</a></p>',
wp_admin_notice(
sprintf(
'%1$s<br><br><a href="%2$s">%3$s</a>',
esc_html__( 'PHP default timezone is not set to UTC. This may cause issues with cron event timings.', 'wp-crontrol' ),
'https://wp-crontrol.com/help/php-default-timezone/',
esc_html__( 'More information', 'wp-crontrol' )
);
?>
</div>
<?php
),
array(
'id' => 'crontrol-timezone-warning',
'type' => 'warning',
)
);
}

$status = test_cron_spawn();

if ( is_wp_error( $status ) ) {
if ( 'crontrol_info' === $status->get_error_code() ) {
?>
<div id="crontrol-status-notice" class="notice notice-info">
<p><?php echo esc_html( $status->get_error_message() ); ?></p>
</div>
<?php
wp_admin_notice(
esc_html( $status->get_error_message() ),
array(
'id' => 'crontrol-status-notice',
'type' => 'info',
)
);
} else {
?>
<div id="crontrol-status-error" class="notice notice-error">
<?php
printf(
'<p>%1$s</p><p><a href="%2$s">%3$s</a></p>',
wp_admin_notice(
sprintf(
'%1$s<br><br><a href="%2$s">%3$s</a>',
sprintf(
/* translators: %s: Error message text. */
esc_html__( 'There was a problem spawning a call to the WP-Cron system on your site. This means WP-Cron events on your site may not work. The problem was: %s', 'wp-crontrol' ),
'</p><p><strong>' . esc_html( $status->get_error_message() ) . '</strong>'
'<br><br><strong>' . esc_html( $status->get_error_message() ) . '</strong>'
),
'https://wp-crontrol.com/help/problems-spawning-wp-cron/',
esc_html__( 'More information', 'wp-crontrol' )
);
?>
</div>
<?php
),
array(
'id' => 'crontrol-status-error',
'type' => 'error',
)
);
}
}
}
Expand Down Expand Up @@ -1587,19 +1592,16 @@ function show_cron_form( $editing ) {
<div id="crontrol_form" class="wrap narrow">
<?php do_tabs(); ?>

<div id="crontrol-event-not-found" class="notice notice-error">
<p>
<?php
printf(
<?php
wp_admin_notice(
sprintf(
'%1$s<br><br>%2$s',
sprintf(
/* translators: %s: The name of the cron event. */
esc_html__( 'The %s event you are trying to edit does not exist.', 'wp-crontrol' ),
'<b>' . esc_html( $edit_id ) . '</b>'
);
?>
</p>
<p>
<?php
echo wp_kses(
),
wp_kses(
sprintf(
/* translators: 1: The time since the event was scheduled, 2: The URL to search for the event. */
__( 'The event probably ran %1$s ago. <a href="%2$s">Click here to see if it was rescheduled</a>.', 'wp-crontrol' ),
Expand All @@ -1611,10 +1613,14 @@ function show_cron_form( $editing ) {
'href' => array(),
),
)
);
?>
</p>
</div>
)
),
array(
'id' => 'crontrol-event-not-found',
'type' => 'error',
)
);
?>
</div>
<?php
return;
Expand Down Expand Up @@ -1779,11 +1785,17 @@ function show_cron_form( $editing ) {
<td>
<?php
if ( $is_editing_url && $existing->integrity_failed() ) {
printf(
'<div class="notice notice-error inline"><p>%1$s</p><p><a href="%2$s">%3$s</a></p></div>',
esc_html__( 'The URL in this event needs to be checked for integrity. This event will not run until you re-save it.', 'wp-crontrol' ),
'https://wp-crontrol.com/help/check-cron-events/',
esc_html__( 'Read what to do', 'wp-crontrol' )
wp_admin_notice(
sprintf(
'%1$s<br><br><a href="%2$s">%3$s</a>',
esc_html__( 'The URL in this event needs to be checked for integrity. This event will not run until you re-save it.', 'wp-crontrol' ),
'https://wp-crontrol.com/help/check-cron-events/',
esc_html__( 'Read what to do', 'wp-crontrol' )
),
array(
'type' => 'error',
'additional_classes' => array( 'inline' ),
)
);
}
?>
Expand Down Expand Up @@ -1832,11 +1844,17 @@ function show_cron_form( $editing ) {
<td>
<?php
if ( $is_editing_php && $existing->integrity_failed() ) {
printf(
'<div class="notice notice-error inline"><p>%1$s</p><p><a href="%2$s">%3$s</a></p></div>',
esc_html__( 'The PHP code in this event needs to be checked for integrity. This event will not run until you re-save it.', 'wp-crontrol' ),
'https://wp-crontrol.com/help/check-cron-events/',
esc_html__( 'Read what to do', 'wp-crontrol' )
wp_admin_notice(
sprintf(
'%1$s<br><br><a href="%2$s">%3$s</a>',
esc_html__( 'The PHP code in this event needs to be checked for integrity. This event will not run until you re-save it.', 'wp-crontrol' ),
'https://wp-crontrol.com/help/check-cron-events/',
esc_html__( 'Read what to do', 'wp-crontrol' )
),
array(
'type' => 'error',
'additional_classes' => array( 'inline' ),
)
);
}
?>
Expand Down Expand Up @@ -1898,13 +1916,19 @@ function show_cron_form( $editing ) {
<td>
<?php
if ( $editing && $existing->has_invalid_args() ) {
printf(
'<div class="notice notice-error inline"><p>%1$s</p><p>%2$s</p></div>',
esc_html__( 'This event has invalid arguments and will not run correctly.', 'wp-crontrol' ),
wp_admin_notice(
sprintf(
/* translators: %s: The PHP type of the invalid value */
esc_html__( 'Arguments should be an array but %s was provided. The event will likely fail with a PHP error when it attempts to run.', 'wp-crontrol' ),
esc_html( gettype( $existing->args ) )
'%1$s<br><br>%2$s',
esc_html__( 'This event has invalid arguments and will not run correctly.', 'wp-crontrol' ),
sprintf(
/* translators: %s: The PHP type of the invalid value */
esc_html__( 'Arguments should be an array but %s was provided. The event will likely fail with a PHP error when it attempts to run.', 'wp-crontrol' ),
esc_html( gettype( $existing->args ) )
)
),
array(
'type' => 'error',
'additional_classes' => array( 'inline' ),
)
);
}
Expand Down Expand Up @@ -2108,7 +2132,6 @@ function admin_manage_page() {
if ( isset( $_GET['crontrol_name'], $_GET['crontrol_message'], $messages[ $_GET['crontrol_message'] ] ) ) {
$hook = wp_unslash( $_GET['crontrol_name'] );
$message = intval( $_GET['crontrol_message'] );
$link = '';

if ( MESSAGE_UNKNOWN_ERROR === $message ) {
$error = get_message();
Expand All @@ -2118,15 +2141,16 @@ function admin_manage_page() {
}
}

printf(
'<div id="crontrol-message" class="notice notice-%1$s is-dismissible"><p>%2$s%3$s</p></div>',
esc_attr( $messages[ $message ][1] ),
wp_admin_notice(
sprintf(
esc_html( $messages[ $message ][0] ),
'<strong>' . esc_html( $hook ) . '</strong>'
),
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
$link
array(
'id' => 'crontrol-message',
'type' => $messages[ $message ][1],
'dismissible' => true,
)
);
}

Expand Down
16 changes: 11 additions & 5 deletions src/event-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,17 @@ public function prepare_items() {
add_action(
'admin_notices',
function () {
printf(
'<div id="crontrol-integrity-failures-message" class="notice notice-error"><p>%1$s</p><p><a href="%2$s">%3$s</a></p></div>',
esc_html__( 'One or more of your cron events needs to be checked for integrity. These events will not run until you check and re-save them.', 'wp-crontrol' ),
'https://wp-crontrol.com/help/check-cron-events/',
esc_html__( 'Read what to do', 'wp-crontrol' )
wp_admin_notice(
sprintf(
'%1$s<br><br><a href="%2$s">%3$s</a>',
esc_html__( 'One or more of your cron events needs to be checked for integrity. These events will not run until you check and re-save them.', 'wp-crontrol' ),
'https://wp-crontrol.com/help/check-cron-events/',
esc_html__( 'Read what to do', 'wp-crontrol' )
),
array(
'id' => 'crontrol-integrity-failures-message',
'type' => 'error',
)
);
}
);
Expand Down
2 changes: 1 addition & 1 deletion wp-crontrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Version: 1.21.0
* Text Domain: wp-crontrol
* Domain Path: /languages/
* Requires at least: 6.4
* Requires at least: 6.5
* Requires PHP: 7.4
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* License: GPL v2 or later
Expand Down
Loading