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 |
---|---|
913 | * 2. Before Maintenance Mode is enabled. |
914 | * 3. Before WordPress begins copying over the necessary files. |
915 | * 4. Before Maintenance Mode is disabled. |
916 | * 5. Before the database is upgraded. |
917 | * |
918 | * @since 2.5.0 |
919 | * |
920 | * @param string $feedback The core update feedback messages. |
921 | */ |
922 | apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) ); |
923 |
|
924 | // Sanity check the unzipped distribution. |
925 | $distro = ''; |
926 | $roots = array( '/wordpress/', '/wordpress-mu/' ); |
927 | foreach ( $roots as $root ) { |
928 | if ( $wp_filesystem->exists( $from . $root . 'readme.html' ) && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' ) ) { |
929 | $distro = $root; |
930 | break; |
931 | } |
Line | Code |
1038 | /* translators: 1: WordPress version number, 2: The PHP extension name needed. */ |
1039 | __( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP extension.' ), |
1040 | $wp_version, |
1041 | 'JSON' |
1042 | ) |
1043 | ); |
1044 | } |
1045 |
|
1046 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1047 | apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) ); |
1048 |
|
1049 | // Don't copy wp-content, we'll deal with that below. |
1050 | // We also copy version.php last so failed updates report their old version. |
1051 | $skip = array( 'wp-content', 'wp-includes/version.php' ); |
1052 | $check_is_writable = array(); |
1053 |
|
1054 | // Check to see which files don't really need updating - only available for 3.7 and higher. |
1055 | if ( function_exists( 'get_core_checksums' ) ) { |
1056 | // Find the local version of the working directory. |
Line | Code |
1100 | $error_data = version_compare( $old_wp_version, '3.7-beta2', '>' ) ? array_keys( $files_not_writable ) : ''; |
1101 |
|
1102 | if ( $files_not_writable ) { |
1103 | return new WP_Error( 'files_not_writable', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), implode( ', ', $error_data ) ); |
1104 | } |
1105 | } |
1106 | } |
1107 |
|
1108 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1109 | apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) ); |
1110 | // Create maintenance file to signal that we are upgrading. |
1111 | $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; |
1112 | $maintenance_file = $to . '.maintenance'; |
1113 | $wp_filesystem->delete( $maintenance_file ); |
1114 | $wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE ); |
1115 |
|
1116 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1117 | apply_filters( 'update_feedback', __( 'Copying the required files…' ) ); |
1118 | // Copy new versions of WP files into place. |
1119 | $result = _copy_dir( $from . $distro, $to, $skip ); |
1120 | if ( is_wp_error( $result ) ) { |
1121 | $result = new WP_Error( $result->get_error_code(), $result->get_error_message(), substr( $result->get_error_data(), strlen( $to ) ) ); |
1122 | } |
1123 |
|
1124 | // Since we know the core files have copied over, we can now copy the version file. |
1125 | if ( ! is_wp_error( $result ) ) { |
1126 | if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) { |
Line | Code |
1205 | $result = copy_dir( $from . $distro . 'wp-content/languages/', $wp_lang_dir ); |
1206 | if ( is_wp_error( $result ) ) { |
1207 | $result = new WP_Error( $result->get_error_code() . '_languages', $result->get_error_message(), substr( $result->get_error_data(), strlen( $wp_lang_dir ) ) ); |
1208 | } |
1209 | } |
1210 | } |
1211 | } |
1212 |
|
1213 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1214 | apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) ); |
1215 | // Remove maintenance file, we're done with potential site-breaking changes. |
1216 | $wp_filesystem->delete( $maintenance_file ); |
1217 |
|
1218 | // 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, preventing installation of Twenty Twelve. |
1219 | if ( '3.5' === $old_wp_version ) { |
1220 | if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' ) ) { |
1221 | $wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' ); |
1222 | } |
1223 | } |
Line | Code |
1299 |
|
1300 | // Remove any Genericons example.html's from the filesystem. |
1301 | _upgrade_422_remove_genericons(); |
1302 |
|
1303 | // Remove the REST API plugin if its version is Beta 4 or lower. |
1304 | _upgrade_440_force_deactivate_incompatible_plugins(); |
1305 |
|
1306 | // Upgrade DB with separate request. |
1307 | /** This filter is documented in wp-admin/includes/update-core.php */ |
1308 | apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); |
1309 | $db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' ); |
1310 | wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) ); |
1311 |
|
1312 | // Clear the cache to prevent an update_option() from saving a stale db_version to the cache. |
1313 | wp_cache_flush(); |
1314 | // Not all cache back ends listen to 'flush'. |
1315 | wp_cache_delete( 'alloptions', 'options' ); |
1316 |
|
1317 | // Remove working directory. |