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 |
|---|---|
| 979 | * 2. Before Maintenance Mode is enabled. |
| 980 | * 3. Before WordPress begins copying over the necessary files. |
| 981 | * 4. Before Maintenance Mode is disabled. |
| 982 | * 5. Before the database is upgraded. |
| 983 | * |
| 984 | * @since 2.5.0 |
| 985 | * |
| 986 | * @param string $feedback The core update feedback messages. |
| 987 | */ |
| 988 | apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) ); |
| 989 | |
| 990 | // Confidence check the unzipped distribution. |
| 991 | $distro = ''; |
| 992 | $roots = array( '/wordpress/', '/wordpress-mu/' ); |
| 993 | |
| 994 | foreach ( $roots as $root ) { |
| 995 | if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) |
| 996 | && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) |
| 997 | ) { |
| Line | Code |
| 1121 | /* translators: 1: WordPress version number, 2: The PHP extension name needed. */ |
| 1122 | __( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP extension.' ), |
| 1123 | $wp_version, |
| 1124 | 'JSON' |
| 1125 | ) |
| 1126 | ); |
| 1127 | } |
| 1128 | |
| 1129 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1130 | apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) ); |
| 1131 | |
| 1132 | /* |
| 1133 | * Don't copy wp-content, we'll deal with that below. |
| 1134 | * We also copy version.php last so failed updates report their old version. |
| 1135 | */ |
| 1136 | $skip = array( 'wp-content', 'wp-includes/version.php' ); |
| 1137 | $check_is_writable = array(); |
| 1138 | |
| 1139 | // Check to see which files don't really need updating - only available for 3.7 and higher. |
| Line | Code |
| 1205 | 'files_not_writable', |
| 1206 | __( 'The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.' ), |
| 1207 | implode( ', ', $error_data ) |
| 1208 | ); |
| 1209 | } |
| 1210 | } |
| 1211 | } |
| 1212 | |
| 1213 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1214 | apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) ); |
| 1215 | |
| 1216 | // Create maintenance file to signal that we are upgrading. |
| 1217 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
| 1218 | $maintenance_file = $to . '.maintenance'; |
| 1219 | $wp_filesystem->delete( $maintenance_file ); |
| 1220 | $wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE ); |
| 1221 | |
| 1222 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1223 | apply_filters( 'update_feedback', __( 'Copying the required files…' ) ); |
| 1224 | |
| 1225 | // Copy new versions of WP files into place. |
| 1226 | $result = copy_dir( $from . $distro, $to, $skip ); |
| 1227 | |
| 1228 | if ( is_wp_error( $result ) ) { |
| 1229 | $result = new WP_Error( |
| 1230 | $result->get_error_code(), |
| 1231 | $result->get_error_message(), |
| 1232 | substr( $result->get_error_data(), strlen( $to ) ) |
| Line | Code |
| 1354 | $result->get_error_message(), |
| 1355 | substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) |
| 1356 | ); |
| 1357 | } |
| 1358 | } |
| 1359 | } |
| 1360 | } |
| 1361 | |
| 1362 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1363 | apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) ); |
| 1364 | |
| 1365 | // Remove maintenance file, we're done with potential site-breaking changes. |
| 1366 | $wp_filesystem->delete( $maintenance_file ); |
| 1367 | |
| 1368 | /* |
| 1369 | * 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, |
| 1370 | * preventing installation of Twenty Twelve. |
| 1371 | */ |
| 1372 | if ( '3.5' === $old_wp_version ) { |
| Line | Code |
| 1469 | |
| 1470 | // Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower. |
| 1471 | _upgrade_440_force_deactivate_incompatible_plugins(); |
| 1472 | |
| 1473 | // Deactivate incompatible plugins. |
| 1474 | _upgrade_core_deactivate_incompatible_plugins(); |
| 1475 | |
| 1476 | // Upgrade DB with separate request. |
| 1477 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1478 | apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); |
| 1479 | |
| 1480 | $db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
| 1481 | wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) ); |
| 1482 | |
| 1483 | // Clear the cache to prevent an update_option() from saving a stale db_version to the cache. |
| 1484 | wp_cache_flush(); |
| 1485 | // Not all cache back ends listen to 'flush'. |
| 1486 | wp_cache_delete( 'alloptions', 'options' ); |
| 1487 | |