Skip to content

Commit

Permalink
Add a check whether the cron job is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Nov 21, 2024
1 parent 74d16a8 commit d8300ad
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3447,6 +3447,10 @@ public function site_status_tests( $tests ) {
'label' => __( 'Friend roles were created', 'friends' ),
'test' => array( $this, 'friend_roles_test' ),
);
$tests['direct']['friends-cron'] = array(
'label' => __( 'Friend cron job is enabled', 'friends' ),
'test' => array( $this, 'friends_cron_test' ),
);
return $tests;
}

Expand Down Expand Up @@ -3513,6 +3517,39 @@ public function friend_roles_test() {
return $result;
}

public function friends_cron_test() {
$result = array(
'label' => __( 'The friend cron job is enabled', 'friends' ),
'status' => 'good',
'badge' => array(
'label' => __( 'Friends', 'friends' ),
'color' => 'green',
),
'description' =>
'<p>' .
__( 'The Friends Plugin uses a cron job to fetch your friends\' feeds.', 'friends' ) .
'</p>',
'test' => 'friends-cron',
);

if ( ! wp_next_scheduled( 'cron_friends_refresh_feeds' ) ) {
$result['label'] = __( 'The friends cron job is not enabled', 'friends' );
$result['badge']['color'] = 'red';
$result['status'] = 'critical';
$result['description'] .= '<p>';
$result['description'] .= wp_kses_post(
sprintf(
// translators: %s is a URL.
__( '<strong>To fix this:</strong> <a href="%s">Enable the Friends cron job</a>.', 'friends' ),
esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', remove_query_arg( '_wp_http_referer' ), self_admin_url( 'admin.php?page=friends-settings&rerun-activate' ) ), 'friends-settings' ) )
)
);
$result['description'] .= '</p>';
}

return $result;
}

public function site_status_test_php_modules( $modules ) {
$modules['mbstring']['required'] = true;
return $modules;
Expand Down

0 comments on commit d8300ad

Please sign in to comment.