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 |
|---|---|
| 208 | * @param string $to Path to old WordPress installation. |
| 209 | * @return WP_Error|null WP_Error on failure, null on success. |
| 210 | */ |
| 211 | function update_core($from, $to) { |
| 212 | global $wp_filesystem, $_old_files; |
| 213 | |
| 214 | @set_time_limit( 300 ); |
| 215 | |
| 216 | // Sanity check the unzipped distribution |
| 217 | apply_filters('update_feedback', __('Verifying the unpacked files')); |
| 218 | if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') || |
| 219 | !$wp_filesystem->exists($from . '/wordpress/wp-includes/functions.php') ) { |
| 220 | $wp_filesystem->delete($from, true); |
| 221 | return new WP_Error('insane_distro', __('The update could not be unpacked') ); |
| 222 | } |
| 223 | |
| 224 | apply_filters('update_feedback', __('Installing the latest version')); |
| 225 | |
| 226 | // Create maintenance file to signal that we are upgrading |
| 227 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
| 228 | $maintenance_file = $to . '.maintenance'; |
| 229 | $wp_filesystem->delete($maintenance_file); |
| 230 | $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE); |
| 231 | |
| 232 | // Copy new versions of WP files into place. |
| 233 | $result = copy_dir($from . '/wordpress', $to); |
| Line | Code |
| 240 | // Remove old files |
| 241 | foreach ( $_old_files as $old_file ) { |
| 242 | $old_file = $to . $old_file; |
| 243 | if ( !$wp_filesystem->exists($old_file) ) |
| 244 | continue; |
| 245 | $wp_filesystem->delete($old_file, true); |
| 246 | } |
| 247 | |
| 248 | // Upgrade DB with separate request |
| 249 | apply_filters('update_feedback', __('Upgrading database')); |
| 250 | $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); |
| 251 | wp_remote_post($db_upgrade_url, array('timeout' => 60)); |
| 252 | |
| 253 | // Remove working directory |
| 254 | $wp_filesystem->delete($from, true); |
| 255 | |
| 256 | // Force refresh of update information |
| 257 | delete_option('update_core'); |
| 258 | |