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 |
---|---|
1076 | * 2. Before Maintenance Mode is enabled. |
1077 | * 3. Before WordPress begins copying over the necessary files. |
1078 | * 4. Before Maintenance Mode is disabled. |
1079 | * 5. Before the database is upgraded. |
1080 | * |
1081 | * @since 2.5.0 |
1082 | * |
1083 | * @param string $feedback The core update feedback messages. |
1084 | */ |
1085 | apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) ); |
1086 |
|
1087 | // Sanity check the unzipped distribution. |
1088 | $distro = ''; |
1089 | $roots = array( '/wordpress/', '/wordpress-mu/' ); |
1090 |
|
1091 | foreach ( $roots as $root ) { |
1092 | if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) |
1093 | && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) |
1094 | ) { |
Line | Code |
1213 | /* translators: 1: WordPress version number, 2: The PHP extension name needed. */ |
1214 | __( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP extension.' ), |
1215 | $wp_version, |
1216 | 'JSON' |
1217 | ) |
1218 | ); |
1219 | } |
1220 |
|
1221 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1222 | apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) ); |
1223 |
|
1224 | // Don't copy wp-content, we'll deal with that below. |
1225 | // We also copy version.php last so failed updates report their old version. |
1226 | $skip = array( 'wp-content', 'wp-includes/version.php' ); |
1227 | $check_is_writable = array(); |
1228 |
|
1229 | // Check to see which files don't really need updating - only available for 3.7 and higher. |
1230 | if ( function_exists( 'get_core_checksums' ) ) { |
1231 | // Find the local version of the working directory. |
Line | Code |
1290 | 'files_not_writable', |
1291 | __( 'The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.' ), |
1292 | implode( ', ', $error_data ) |
1293 | ); |
1294 | } |
1295 | } |
1296 | } |
1297 |
|
1298 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1299 | apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) ); |
1300 |
|
1301 | // Create maintenance file to signal that we are upgrading. |
1302 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
1303 | $maintenance_file = $to . '.maintenance'; |
1304 | $wp_filesystem->delete( $maintenance_file ); |
1305 | $wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE ); |
1306 |
|
1307 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1308 | apply_filters( 'update_feedback', __( 'Copying the required files…' ) ); |
1309 |
|
1310 | // Copy new versions of WP files into place. |
1311 | $result = copy_dir( $from . $distro, $to, $skip ); |
1312 |
|
1313 | if ( is_wp_error( $result ) ) { |
1314 | $result = new WP_Error( |
1315 | $result->get_error_code(), |
1316 | $result->get_error_message(), |
1317 | substr( $result->get_error_data(), strlen( $to ) ) |
Line | Code |
1426 | $result->get_error_message(), |
1427 | substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) |
1428 | ); |
1429 | } |
1430 | } |
1431 | } |
1432 | } |
1433 |
|
1434 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1435 | apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) ); |
1436 |
|
1437 | // Remove maintenance file, we're done with potential site-breaking changes. |
1438 | $wp_filesystem->delete( $maintenance_file ); |
1439 |
|
1440 | // 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, |
1441 | // preventing installation of Twenty Twelve. |
1442 | if ( '3.5' === $old_wp_version ) { |
1443 | if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) |
1444 | && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' ) |
Line | Code |
1536 |
|
1537 | // Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower. |
1538 | _upgrade_440_force_deactivate_incompatible_plugins(); |
1539 |
|
1540 | // Deactivate incompatible plugins. |
1541 | _upgrade_core_deactivate_incompatible_plugins(); |
1542 |
|
1543 | // Upgrade DB with separate request. |
1544 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1545 | apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); |
1546 |
|
1547 | $db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
1548 | wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) ); |
1549 |
|
1550 | // Clear the cache to prevent an update_option() from saving a stale db_version to the cache. |
1551 | wp_cache_flush(); |
1552 | // Not all cache back ends listen to 'flush'. |
1553 | wp_cache_delete( 'alloptions', 'options' ); |
1554 |
|