WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 283 | |
| 284 | if ( !$mysql_compat && !$php_compat ) |
| 285 | return new WP_Error( 'php_mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ) ); |
| 286 | elseif ( !$php_compat ) |
| 287 | return new WP_Error( 'php_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version ) ); |
| 288 | elseif ( !$mysql_compat ) |
| 289 | return new WP_Error( 'mysql_not_compatible', sprintf( __('The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version ) ); |
| 290 | |
| 291 | // Sanity check the unzipped distribution |
| 292 | apply_filters('update_feedback', __('Verifying the unpacked files…')); |
| 293 | $distro = ''; |
| 294 | $roots = array( '/wordpress', '/wordpress-mu' ); |
| 295 | foreach( $roots as $root ) { |
| 296 | if ( $wp_filesystem->exists($from . $root . '/wp-settings.php') && $wp_filesystem->exists($from . $root . '/wp-admin/admin.php') && |
| 297 | $wp_filesystem->exists($from . $root . '/wp-includes/functions.php') ) { |
| 298 | $distro = $root; |
| 299 | break; |
| 300 | } |
| 301 | } |
| 302 | if ( !$distro ) { |
| 303 | $wp_filesystem->delete($from, true); |
| 304 | return new WP_Error('insane_distro', __('The update could not be unpacked') ); |
| 305 | } |
| 306 | |
| 307 | apply_filters('update_feedback', __('Installing the latest version…')); |
| 308 | |
| 309 | // Create maintenance file to signal that we are upgrading |
| 310 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
| 311 | $maintenance_file = $to . '.maintenance'; |
| 312 | $wp_filesystem->delete($maintenance_file); |
| 313 | $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); |
| 314 | |
| 315 | // Copy new versions of WP files into place. |
| 316 | $result = copy_dir($from . $distro, $to); |
| Line | Code |
| 323 | // Remove old files |
| 324 | foreach ( $_old_files as $old_file ) { |
| 325 | $old_file = $to . $old_file; |
| 326 | if ( !$wp_filesystem->exists($old_file) ) |
| 327 | continue; |
| 328 | $wp_filesystem->delete($old_file, true); |
| 329 | } |
| 330 | |
| 331 | // Upgrade DB with separate request |
| 332 | apply_filters('update_feedback', __('Upgrading database…')); |
| 333 | $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); |
| 334 | wp_remote_post($db_upgrade_url, array('timeout' => 60)); |
| 335 | |
| 336 | // Remove working directory |
| 337 | $wp_filesystem->delete($from, true); |
| 338 | |
| 339 | // Force refresh of update information |
| 340 | if ( function_exists('delete_site_transient') ) |
| 341 | delete_site_transient('update_core'); |