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 |
|---|---|
| 956 | * 2. Before Maintenance Mode is enabled. |
| 957 | * 3. Before WordPress begins copying over the necessary files. |
| 958 | * 4. Before Maintenance Mode is disabled. |
| 959 | * 5. Before the database is upgraded. |
| 960 | * |
| 961 | * @since 2.5.0 |
| 962 | * |
| 963 | * @param string $feedback The core update feedback messages. |
| 964 | */ |
| 965 | apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) ); |
| 966 | |
| 967 | // Sanity check the unzipped distribution. |
| 968 | $distro = ''; |
| 969 | $roots = array( '/wordpress/', '/wordpress-mu/' ); |
| 970 | |
| 971 | foreach ( $roots as $root ) { |
| 972 | if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) |
| 973 | && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) |
| 974 | ) { |
| Line | Code |
| 1093 | /* translators: 1: WordPress version number, 2: The PHP extension name needed. */ |
| 1094 | __( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP extension.' ), |
| 1095 | $wp_version, |
| 1096 | 'JSON' |
| 1097 | ) |
| 1098 | ); |
| 1099 | } |
| 1100 | |
| 1101 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1102 | apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) ); |
| 1103 | |
| 1104 | // Don't copy wp-content, we'll deal with that below. |
| 1105 | // We also copy version.php last so failed updates report their old version. |
| 1106 | $skip = array( 'wp-content', 'wp-includes/version.php' ); |
| 1107 | $check_is_writable = array(); |
| 1108 | |
| 1109 | // Check to see which files don't really need updating - only available for 3.7 and higher. |
| 1110 | if ( function_exists( 'get_core_checksums' ) ) { |
| 1111 | // Find the local version of the working directory. |
| Line | Code |
| 1170 | 'files_not_writable', |
| 1171 | __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), |
| 1172 | implode( ', ', $error_data ) |
| 1173 | ); |
| 1174 | } |
| 1175 | } |
| 1176 | } |
| 1177 | |
| 1178 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1179 | apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) ); |
| 1180 | |
| 1181 | // Create maintenance file to signal that we are upgrading. |
| 1182 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
| 1183 | $maintenance_file = $to . '.maintenance'; |
| 1184 | $wp_filesystem->delete( $maintenance_file ); |
| 1185 | $wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE ); |
| 1186 | |
| 1187 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1188 | apply_filters( 'update_feedback', __( 'Copying the required files…' ) ); |
| 1189 | |
| 1190 | // Copy new versions of WP files into place. |
| 1191 | $result = _copy_dir( $from . $distro, $to, $skip ); |
| 1192 | |
| 1193 | if ( is_wp_error( $result ) ) { |
| 1194 | $result = new WP_Error( |
| 1195 | $result->get_error_code(), |
| 1196 | $result->get_error_message(), |
| 1197 | substr( $result->get_error_data(), strlen( $to ) ) |
| Line | Code |
| 1306 | $result->get_error_message(), |
| 1307 | substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) |
| 1308 | ); |
| 1309 | } |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1315 | apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) ); |
| 1316 | |
| 1317 | // Remove maintenance file, we're done with potential site-breaking changes. |
| 1318 | $wp_filesystem->delete( $maintenance_file ); |
| 1319 | |
| 1320 | // 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, |
| 1321 | // preventing installation of Twenty Twelve. |
| 1322 | if ( '3.5' === $old_wp_version ) { |
| 1323 | if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) |
| 1324 | && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' ) |
| Line | Code |
| 1416 | |
| 1417 | // Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower. |
| 1418 | _upgrade_440_force_deactivate_incompatible_plugins(); |
| 1419 | |
| 1420 | // Deactivate the Gutenberg plugin if its version is 11.8 or lower. |
| 1421 | _upgrade_590_force_deactivate_incompatible_plugins(); |
| 1422 | |
| 1423 | // Upgrade DB with separate request. |
| 1424 | /** This filter is documented in wp-admin/includes/update-core.php */ |
| 1425 | apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); |
| 1426 | |
| 1427 | $db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
| 1428 | wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) ); |
| 1429 | |
| 1430 | // Clear the cache to prevent an update_option() from saving a stale db_version to the cache. |
| 1431 | wp_cache_flush(); |
| 1432 | // Not all cache back ends listen to 'flush'. |
| 1433 | wp_cache_delete( 'alloptions', 'options' ); |
| 1434 | |