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