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 |
|---|---|
| 629 | * @param string $to Path to old WordPress installation. |
| 630 | * @return WP_Error|null WP_Error on failure, null on success. |
| 631 | */ |
| 632 | function update_core($from, $to) { |
| 633 | global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb; |
| 634 | |
| 635 | @set_time_limit( 300 ); |
| 636 | |
| 637 | // Sanity check the unzipped distribution |
| 638 | apply_filters( 'update_feedback', __('Verifying the unpacked files…') ); |
| 639 | $distro = ''; |
| 640 | $roots = array( '/wordpress/', '/wordpress-mu/' ); |
| 641 | foreach ( $roots as $root ) { |
| 642 | if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) ) { |
| 643 | $distro = $root; |
| 644 | break; |
| 645 | } |
| 646 | } |
| 647 | if ( ! $distro ) { |
| Line | Code |
| 675 | $wp_filesystem->delete($from, true); |
| 676 | |
| 677 | if ( !$mysql_compat && !$php_compat ) |
| 678 | 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 ) ); |
| 679 | elseif ( !$php_compat ) |
| 680 | 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 ) ); |
| 681 | elseif ( !$mysql_compat ) |
| 682 | 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 ) ); |
| 683 | |
| 684 | apply_filters('update_feedback', __('Installing the latest version…')); |
| 685 | |
| 686 | // Create maintenance file to signal that we are upgrading |
| 687 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
| 688 | $maintenance_file = $to . '.maintenance'; |
| 689 | $wp_filesystem->delete($maintenance_file); |
| 690 | $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); |
| 691 | |
| 692 | // Copy new versions of WP files into place. |
| 693 | $result = _copy_dir($from . $distro, $to, array('wp-content') ); |
| Line | Code |
| 769 | // Remove old files |
| 770 | foreach ( $_old_files as $old_file ) { |
| 771 | $old_file = $to . $old_file; |
| 772 | if ( !$wp_filesystem->exists($old_file) ) |
| 773 | continue; |
| 774 | $wp_filesystem->delete($old_file, true); |
| 775 | } |
| 776 | |
| 777 | // Upgrade DB with separate request |
| 778 | apply_filters('update_feedback', __('Upgrading database…')); |
| 779 | $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); |
| 780 | wp_remote_post($db_upgrade_url, array('timeout' => 60)); |
| 781 | |
| 782 | // Remove working directory |
| 783 | $wp_filesystem->delete($from, true); |
| 784 | |
| 785 | // Force refresh of update information |
| 786 | if ( function_exists('delete_site_transient') ) |
| 787 | delete_site_transient('update_core'); |