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