_get_cron_lock

Retrieves the cron lock.

Description

(string|false) _get_cron_lock(); 

Returns the uncached doing_cron transient.

Returns (string|false)

Value of the `doing_cron` transient, 0|false otherwise.


Usage

  1. if ( !function_exists( '_get_cron_lock' ) ) { 
  2. require_once '/wp-cron.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = _get_cron_lock(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-cron.php  
  1. function _get_cron_lock() { 
  2. global $wpdb; 
  3.  
  4. $value = 0; 
  5. /** 
  6. * Skip local cache and force re-fetch of doing_cron transient 
  7. * in case another process updated the cache. 
  8. */ 
  9. $value = wp_cache_get( 'doing_cron', 'transient', true ); 
  10. } else { 
  11. $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) ); 
  12. if ( is_object( $row ) ) 
  13. $value = $row->option_value; 
  14.  
  15. return $value;