Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
_upgrade_cron_array() WordPress Function
The upgrade_cron_array() function is used to upgrade the cron array to the new format. The new format is an associative array of arrays with the following keys: 'time', 'schedule', 'args', and 'interval'. The 'time' key is used to store the time when the event should run, the 'schedule' key is used to store the recurrence schedule for the event, the 'args' key is used to store the arguments for the event, and the 'interval' key is used to store the interval for the event.
_upgrade_cron_array( array $cron ) #
Upgrade a Cron info array.
Description
This function upgrades the Cron info array to version 2.
Parameters
- $cron
(array)(Required)Cron info array from _get_cron_array().
Return
(array) An upgraded Cron info array.
Source
File: wp-includes/cron.php
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 ); return $new_cron; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |