Astra_Addon_Background_Updater::test_cron()
Check Cron Status
Description
Gets the current cron status by performing a test spawn. Cached for one hour when all is well.
Return
(true) if there is a problem spawning a call to Wp-Cron system.
Source
File: classes/class-astra-addon-background-updater.php
public function test_cron() { global $wp_version; if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) { return true; } if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) { return true; } $cached_status = get_transient( 'astra-addon-cron-test-ok' ); if ( $cached_status ) { return false; } $sslverify = version_compare( $wp_version, 4.0, '<' ); $doing_wp_cron = sprintf( '%.22F', microtime( true ) ); $cron_request = apply_filters( 'cron_request', array( 'url' => site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron ), 'args' => array( 'timeout' => 3, 'blocking' => true, 'sslverify' => apply_filters( 'https_local_ssl_verify', $sslverify ), ), ) ); $result = wp_remote_post( $cron_request['url'], $cron_request['args'] ); if ( wp_remote_retrieve_response_code( $result ) >= 300 ) { return true; } else { set_transient( 'astra-addon-cron-test-ok', 1, 3600 ); return false; } return $migration_fallback; }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
2.3.0 | Introduced. |