Upgrades a cron info array.
Description
This function upgrades the cron info array to version 2.
Parameters
$cron
arrayrequired- Cron info array from _get_cron_array() .
Source
function _upgrade_cron_array( $cron ) {
if ( isset( $cron['version'] ) && 2 === $cron['version'] ) {
return $cron;
}
$new_cron = array();
foreach ( (array) $cron as $timestamp => $hooks ) {
foreach ( (array) $hooks as $hook => $args ) {
$key = md5( serialize( $args['args'] ) );
$new_cron[ $timestamp ][ $hook ][ $key ] = $args;
}
}
$new_cron['version'] = 2;
update_option( 'cron', $new_cron, true );
return $new_cron;
}
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.