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 |
---|---|
932 | * 2. Before Maintenance Mode is enabled. |
933 | * 3. Before WordPress begins copying over the necessary files. |
934 | * 4. Before Maintenance Mode is disabled. |
935 | * 5. Before the database is upgraded. |
936 | * |
937 | * @since 2.5.0 |
938 | * |
939 | * @param string $feedback The core update feedback messages. |
940 | */ |
941 | apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) ); |
942 |
|
943 | // Sanity check the unzipped distribution. |
944 | $distro = ''; |
945 | $roots = array( '/wordpress/', '/wordpress-mu/' ); |
946 |
|
947 | foreach ( $roots as $root ) { |
948 | if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) |
949 | && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) |
950 | ) { |
Line | Code |
1069 | /* translators: 1: WordPress version number, 2: The PHP extension name needed. */ |
1070 | __( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP extension.' ), |
1071 | $wp_version, |
1072 | 'JSON' |
1073 | ) |
1074 | ); |
1075 | } |
1076 |
|
1077 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1078 | apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) ); |
1079 |
|
1080 | // Don't copy wp-content, we'll deal with that below. |
1081 | // We also copy version.php last so failed updates report their old version. |
1082 | $skip = array( 'wp-content', 'wp-includes/version.php' ); |
1083 | $check_is_writable = array(); |
1084 |
|
1085 | // Check to see which files don't really need updating - only available for 3.7 and higher. |
1086 | if ( function_exists( 'get_core_checksums' ) ) { |
1087 | // Find the local version of the working directory. |
Line | Code |
1146 | 'files_not_writable', |
1147 | __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), |
1148 | implode( ', ', $error_data ) |
1149 | ); |
1150 | } |
1151 | } |
1152 | } |
1153 |
|
1154 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1155 | apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) ); |
1156 |
|
1157 | // Create maintenance file to signal that we are upgrading. |
1158 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
1159 | $maintenance_file = $to . '.maintenance'; |
1160 | $wp_filesystem->delete( $maintenance_file ); |
1161 | $wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE ); |
1162 |
|
1163 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1164 | apply_filters( 'update_feedback', __( 'Copying the required files…' ) ); |
1165 |
|
1166 | // Copy new versions of WP files into place. |
1167 | $result = _copy_dir( $from . $distro, $to, $skip ); |
1168 |
|
1169 | if ( is_wp_error( $result ) ) { |
1170 | $result = new WP_Error( |
1171 | $result->get_error_code(), |
1172 | $result->get_error_message(), |
1173 | substr( $result->get_error_data(), strlen( $to ) ) |
Line | Code |
1282 | $result->get_error_message(), |
1283 | substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) |
1284 | ); |
1285 | } |
1286 | } |
1287 | } |
1288 | } |
1289 |
|
1290 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1291 | apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) ); |
1292 |
|
1293 | // Remove maintenance file, we're done with potential site-breaking changes. |
1294 | $wp_filesystem->delete( $maintenance_file ); |
1295 |
|
1296 | // 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, |
1297 | // preventing installation of Twenty Twelve. |
1298 | if ( '3.5' === $old_wp_version ) { |
1299 | if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) |
1300 | && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' ) |
Line | Code |
1392 |
|
1393 | // Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower. |
1394 | _upgrade_440_force_deactivate_incompatible_plugins(); |
1395 |
|
1396 | // Deactivate the Gutenberg plugin if its version is 10.7 or lower. |
1397 | _upgrade_580_force_deactivate_incompatible_plugins(); |
1398 |
|
1399 | // Upgrade DB with separate request. |
1400 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1401 | apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); |
1402 |
|
1403 | $db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
1404 | wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) ); |
1405 |
|
1406 | // Clear the cache to prevent an update_option() from saving a stale db_version to the cache. |
1407 | wp_cache_flush(); |
1408 | // Not all cache back ends listen to 'flush'. |
1409 | wp_cache_delete( 'alloptions', 'options' ); |
1410 |
|