list_core_update( object $update )
- Since
- 2.7.0
- Source
wp-admin/update-core.php:36
Compatibility
- WordPress
- since 2.7.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$updateobject
Performance profile
How much work a call to list_core_update() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Heavy
- Scaling
- Constant
- Instructions
- 155–218
- Plugin surface
- None
- Called by
- 2
Reads or writes the filesystem via file_exists().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 358.
Nothing here hands control to plugin code.
2 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- filesystemfilesystem access
file_exists()called directly - hookthird-party callbacks
apply_filters()one call below list_core_update() - optionnetwork option
get_site_option()one call below list_core_update() - transienttransient
get_site_transient()one call below list_core_update()
Further down the call graph this can also reach cache, serialize and query. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 16 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost list_core_update() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($update) && !file_exists() | 155–168 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr() |
!isset($update) && !file_exists() | 159–178 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), get_locale() |
!isset($update) && !file_exists() | 161–172 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), __() |
!isset($update) && !file_exists() | 162–180 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), submit_button() |
!isset($update) && !file_exists() | 166–190 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), submit_button(), get_locale() |
!isset($update) && !file_exists() | 167–182 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), __(), submit_button() |
!isset($update) && !file_exists() | 168–184 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), submit_button(), __() |
!isset($update) && !file_exists() | 171–192 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), __(), submit_button(), get_locale() |
!isset($update) && !file_exists() | 173–186 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), __(), submit_button(), __() |
!isset($update) && !file_exists() | 174–193 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), submit_button(), __(), submit_button() |
!isset($update) && !file_exists() | 178–203 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), submit_button(), __(), submit_button(), get_locale() |
!isset($update) && !file_exists() && $wp_version === false | 179–193 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), get_locale(), __(), sprintf() |
4 further outcomes, up to 218 instructions
!isset($update) && !file_exists() | 180–197 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), submit_button(), __(), submit_button(), __() |
!isset($update) && !file_exists() && $wp_version === false | 186–205 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), submit_button(), get_locale(), __(), sprintf() |
!isset($update) && !file_exists() && $wp_version === false | 191–207 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), __(), submit_button(), get_locale(), __(), sprintf() |
!isset($update) && !file_exists() && $wp_version === false | 198–218 | wp_get_wp_version(), get_locale(), ->db_version(), __(), sprintf(), version_compare(), file_exists(), version_compare(), __(), esc_url(), sanitize_title(), sprintf(), __(), wp_get_update_php_url(), esc_url(), sprintf(), wp_get_update_php_annotation(), __(), sprintf(), esc_url(), wp_nonce_field(), esc_attr(), esc_attr(), submit_button(), __(), submit_button(), get_locale(), __(), sprintf() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 358 | 155–218 | 37 | |
| 8.5 | 358 | 155–218 | 37 | |
| 8.4 | 358 | 155–218 | 37 | 8 fewer instructions than PHP 8.3 |
| 8.3 | 366 | 161–224 | 37 | |
| 8.2 | 366 | 161–224 | 37 | |
| 8.1 | 366 | 161–224 | 37 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 367 | 161–225 | 37 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 11
- wp_get_wp_version()Returns the current WordPress version.
- get_locale()Retrieves the current locale.
- get_core_updates()Gets available core updates.
- __()Retrieves the translation of $text.
- esc_url()Checks and cleans a URL.
- sanitize_title()Sanitizes a string into a slug, which can be used in URLs or HTML attributes.
- wp_get_update_php_url()Gets the URL to learn more about updating the PHP version the site is running on.
- wp_get_update_php_annotation()Returns the default annotation for the web hosting altering the "Update PHP" page URL.
- wp_nonce_field()Retrieves or display nonce hidden field for forms.
- esc_attr()Escaping for HTML attributes.
- submit_button()Echoes a submit button, with provided text and appropriate class(es).
Used by · 2
- core_upgrade_preamble()Display upgrade WordPress for downloading latest or upgrading automatically form.
- dismissed_updates()Display dismissed updates.
Source code
function list_core_update( $update ) { global $wp_local_package, $wpdb; static $first_pass = true; $wp_version = wp_get_wp_version(); $version_string = sprintf( '%s–%s', $update->current, get_locale() ); if ( 'en_US' === $update->locale && 'en_US' === get_locale() ) { $version_string = $update->current; } elseif ( 'en_US' === $update->locale && $update->packages->partial && $wp_version === $update->partial_version ) { $updates = get_core_updates(); if ( $updates && 1 === count( $updates ) ) { // If the only available update is a partial builds, it doesn't need a language-specific version string. $version_string = $update->current; } } elseif ( 'en_US' === $update->locale && 'en_US' !== get_locale() ) { $version_string = sprintf( '%s–%s', $update->current, $update->locale ); } $current = false; if ( ! isset( $update->response ) || 'latest' === $update->response ) { $current = true; } $message = ''; $form_action = 'update-core.php?action=do-core-upgrade'; $php_version = PHP_VERSION; $mysql_version = $wpdb->db_version(); $show_buttons = true; // Nightly build versions have two hyphens and a commit number. if ( preg_match( '/-\w+-\d+/', $update->current ) ) { // Retrieve the major version number. preg_match( '/^\d+.\d+/', $update->current, $update_major ); /* translators: %s: WordPress version. */ $submit = sprintf( __( 'Update to latest %s nightly' ), $update_major[0] ); } else { /* translators: %s: WordPress version. */ $submit = sprintf( __( 'Update to version %s' ), $version_string ); } if ( 'development' === $update->response ) { $message = __( 'You can update to the latest nightly build manually:' ); } else { if ( $current ) { /* translators: %s: WordPress version. */ $submit = sprintf( __( 'Re-install version %s' ), $version_string ); $form_action = 'update-core.php?action=do-core-reinstall'; } else { $php_compat = version_compare( $php_version, $update->php_version, '>=' ); if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { $mysql_compat = true; } else { $mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' ); } $version_url = sprintf( /* translators: %s: WordPress version. */ esc_url( __( 'https://wordpress.org/documentation/wordpress-version/version-%s/' ) ), sanitize_title( $update->current ) ); $php_update_message = '</p><p>' . sprintf( /* translators: %s: URL to Update PHP page. */ __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) ); $annotation = wp_get_update_php_annotation(); if ( $annotation ) { $php_update_message .= '</p><p><em>' . $annotation . '</em>'; } if ( ! $mysql_compat && ! $php_compat ) { $message = sprintf( /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number. */ __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), $version_url, $update->current,Changelog
Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-admin/update-core.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.