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 6 times in this file.
| Line | Code |
|---|---|
| 1085 | * 2. Before Maintenance Mode is enabled. |
| 1086 | * 3. Before WordPress begins copying over the necessary files. |
| 1087 | * 4. Before Maintenance Mode is disabled. |
| 1088 | * 5. Before the database is upgraded. |
| 1089 | * |
| 1090 | * @since 2.5.0 |
| 1091 | * |
| 1092 | * @param string $feedback The core update feedback messages. |
| 1093 | */ |
| 1094 | apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) ); |
| 1095 | |
| 1096 | // Sanity check the unzipped distribution. |
| 1097 | $distro = ''; |
| 1098 | $roots = array( '/wordpress/', '/wordpress-mu/' ); |
| 1099 | |
| 1100 | foreach ( $roots as $root ) { |
| 1101 | if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) |
| 1102 | && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) |
| 1103 | ) { |
| Line | Code |
| 1227 | /* translators: 1: WordPress version number, 2: The PHP extension name needed. */ |
| 1228 | __( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP extension.' ), |
| 1229 | $wp_version, |
| 1230 | 'JSON' |
| 1231 | ) |
| 1232 | ); |
| 1233 | } |
| 1234 | |
| 1235 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1236 | apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) ); |
| 1237 | |
| 1238 | /* |
| 1239 | * Don't copy wp-content, we'll deal with that below. |
| 1240 | * We also copy version.php last so failed updates report their old version. |
| 1241 | */ |
| 1242 | $skip = array( 'wp-content', 'wp-includes/version.php' ); |
| 1243 | $check_is_writable = array(); |
| 1244 | |
| 1245 | // Check to see which files don't really need updating - only available for 3.7 and higher. |
| Line | Code |
| 1311 | 'files_not_writable', |
| 1312 | __( 'The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.' ), |
| 1313 | implode( ', ', $error_data ) |
| 1314 | ); |
| 1315 | } |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1320 | apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) ); |
| 1321 | |
| 1322 | // Create maintenance file to signal that we are upgrading. |
| 1323 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
| 1324 | $maintenance_file = $to . '.maintenance'; |
| 1325 | $wp_filesystem->delete( $maintenance_file ); |
| 1326 | $wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE ); |
| 1327 | |
| 1328 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1329 | apply_filters( 'update_feedback', __( 'Copying the required files…' ) ); |
| 1330 | |
| 1331 | // Copy new versions of WP files into place. |
| 1332 | $result = copy_dir( $from . $distro, $to, $skip ); |
| 1333 | |
| 1334 | if ( is_wp_error( $result ) ) { |
| 1335 | $result = new WP_Error( |
| 1336 | $result->get_error_code(), |
| 1337 | $result->get_error_message(), |
| 1338 | substr( $result->get_error_data(), strlen( $to ) ) |
| Line | Code |
| 1460 | $result->get_error_message(), |
| 1461 | substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) |
| 1462 | ); |
| 1463 | } |
| 1464 | } |
| 1465 | } |
| 1466 | } |
| 1467 | |
| 1468 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1469 | apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) ); |
| 1470 | |
| 1471 | // Remove maintenance file, we're done with potential site-breaking changes. |
| 1472 | $wp_filesystem->delete( $maintenance_file ); |
| 1473 | |
| 1474 | /* |
| 1475 | * 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, |
| 1476 | * preventing installation of Twenty Twelve. |
| 1477 | */ |
| 1478 | if ( '3.5' === $old_wp_version ) { |
| Line | Code |
| 1575 | |
| 1576 | // Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower. |
| 1577 | _upgrade_440_force_deactivate_incompatible_plugins(); |
| 1578 | |
| 1579 | // Deactivate incompatible plugins. |
| 1580 | _upgrade_core_deactivate_incompatible_plugins(); |
| 1581 | |
| 1582 | // Upgrade DB with separate request. |
| 1583 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1584 | apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); |
| 1585 | |
| 1586 | $db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
| 1587 | wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) ); |
| 1588 | |
| 1589 | // Clear the cache to prevent an update_option() from saving a stale db_version to the cache. |
| 1590 | wp_cache_flush(); |
| 1591 | // Not all cache back ends listen to 'flush'. |
| 1592 | wp_cache_delete( 'alloptions', 'options' ); |
| 1593 | |