Changeset 44483
- Timestamp:
- 01/08/2019 09:48:07 PM (6 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-cron.php
r42343 r44483 67 67 } 68 68 69 if ( false === $crons = _get_cron_array() ) { 69 $crons = wp_get_ready_cron_jobs(); 70 if ( empty( $crons ) ) { 70 71 die(); 71 72 } 72 73 $keys = array_keys( $crons );74 $gmt_time = microtime( true );75 76 if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) {77 die();78 }79 80 73 81 74 // The cron lock: a unix timestamp from when the cron was spawned. -
trunk/src/wp-includes/cron.php
r44375 r44483 642 642 643 643 //sanity check 644 $crons = _get_cron_array();645 if ( ! is_array( $crons ) ) {644 $crons = wp_get_ready_cron_jobs(); 645 if ( empty( $crons ) ) { 646 646 return false; 647 647 } … … 737 737 } 738 738 739 $crons = _get_cron_array();740 if ( false === $crons) {739 $crons = wp_get_ready_cron_jobs(); 740 if ( empty( $crons ) ) { 741 741 return 0; 742 742 } … … 855 855 } 856 856 857 /** 858 * Retrieve cron jobs ready to be run. 859 * 860 * Returns the results of _get_cron_array() limited to events ready to be run, 861 * ie, with a timestamp in the past. 862 * 863 * @since 5.1.0 864 * 865 * @return array Cron jobs ready to be run. 866 */ 867 function wp_get_ready_cron_jobs() { 868 /** 869 * Filter to preflight or hijack retrieving ready cron jobs. 870 * 871 * Returning an array will short-circuit the normal retrieval of ready 872 * cron jobs, causing the function to return the filtered value instead. 873 * 874 * @since 5.1.0 875 * 876 * @param null|array $pre Array of ready cron tasks to return instead. Default null 877 * to continue using results from _get_cron_array(). 878 */ 879 $pre = apply_filters( 'pre_get_ready_cron_jobs', null ); 880 if ( null !== $pre ) { 881 return $pre; 882 } 883 884 $crons = _get_cron_array(); 885 886 if ( false === $crons ) { 887 return array(); 888 } 889 890 $gmt_time = microtime( true ); 891 $keys = array_keys( $crons ); 892 if ( isset( $keys[0] ) && $keys[0] > $gmt_time ) { 893 return array(); 894 } 895 896 $results = array(); 897 foreach ( $crons as $timestamp => $cronhooks ) { 898 if ( $timestamp > $gmt_time ) { 899 break; 900 } 901 $results[ $timestamp ] = $cronhooks; 902 } 903 904 return $results; 905 } 906 857 907 // 858 908 // Private functions
Note: See TracChangeset
for help on using the changeset viewer.