Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
CronLockTimeoutHealthCheck
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 test
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3namespace NewfoldLabs\WP\Module\Performance\HealthChecks;
4
5/**
6 * Health check for WP Cron lock timeout.
7 */
8class CronLockTimeoutHealthCheck extends HealthCheck {
9    /**
10     * Constructor.
11     */
12    public function __construct() {
13        $this->id           = 'wp-cron-lock-timeout';
14        $this->title        = esc_html__( 'WP Cron Lock Timeout', 'wp-module-performance' );
15        $this->passing_text = esc_html__( 'Cron lock timeout is set to 60 seconds or less.', 'wp-module-performance' );
16        $this->failing_text = esc_html__( 'Cron lock timeout is set to a high number.', 'wp-module-performance' );
17        $this->description  = esc_html__( 'Cron lock timeout affects how long a cron job can run for. Setting it to a lower number can improve performance.', 'wp-module-performance' );
18    }
19
20    /**
21     * Test the WP Cron lock timeout setting.
22     *
23     * @return bool
24     */
25    public function test() {
26        return defined( 'WP_CRON_LOCK_TIMEOUT' ) && constant( 'WP_CRON_LOCK_TIMEOUT' ) <= 300;
27    }
28}