_upgrade_cron_array

Upgrade a Cron info array.

Description

(array) _upgrade_cron_array( (array) $cron ); 

This function upgrades the Cron info array to version 2.

Returns (array)

An upgraded Cron info array.

Parameters (1)

0. $cron (array)
Cron info array from _get_cron_array().

Usage

  1. if ( !function_exists( '_upgrade_cron_array' ) ) { 
  2. require_once ABSPATH . WPINC . '/cron.php'; 
  3.  
  4. // Cron info array from _get_cron_array(). 
  5. $cron = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _upgrade_cron_array($cron); 
  9.  

Defined (1)

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

/wp-includes/cron.php  
  1. function _upgrade_cron_array($cron) { 
  2. if ( isset($cron['version']) && 2 == $cron['version']) 
  3. return $cron; 
  4.  
  5. $new_cron = array(); 
  6.  
  7. foreach ( (array) $cron as $timestamp => $hooks) { 
  8. foreach ( (array) $hooks as $hook => $args ) { 
  9. $key = md5(serialize($args['args'])); 
  10. $new_cron[$timestamp][$hook][$key] = $args; 
  11.  
  12. $new_cron['version'] = 2; 
  13. update_option( 'cron', $new_cron ); 
  14. return $new_cron;