Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: update_feedback

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 6 times in this file.

Line Code
1058       * 2. Before Maintenance Mode is enabled.
1059       * 3. Before WordPress begins copying over the necessary files.
1060       * 4. Before Maintenance Mode is disabled.
1061       * 5. Before the database is upgraded.
1062       *
1063       * @since 2.5.0
1064       *
1065       * @param string $feedback The core update feedback messages.
1066       */
1067      apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) );
1068
1069      // Confidence check the unzipped distribution.
1070      $distro = '';
1071      $roots  = array( '/wordpress/', '/wordpress-mu/' );
1072
1073      foreach ( $roots as $root ) {
1074           if ( $wp_filesystem->exists( $from . $root . 'readme.html' )
1075                && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' )
1076           ) {
 
Line Code
1212           }
1213
1214           // Add a warning when required PHP extensions are missing.
1215           if ( ! empty( $missing_extensions->errors ) ) {
1216                return $missing_extensions;
1217           }
1218      }
1219
1220      /** This filter is documented in wp-admin/includes/update-core.php */
1221      apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );
1222
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       */
1227      $skip              = array( 'wp-content', 'wp-includes/version.php' );
1228      $check_is_writable = array();
1229
1230      // Check to see which files don't really need updating - only available for 3.7 and higher.
 
Line Code
1296                          'files_not_writable',
1297                          __( 'The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.' ),
1298                          implode( ', ', $error_data )
1299                     );
1300                }
1301           }
1302      }
1303
1304      /** This filter is documented in wp-admin/includes/update-core.php */
1305      apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) );
1306
1307      // Create maintenance file to signal that we are upgrading.
1308      $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
1309      $maintenance_file   = $to . '.maintenance';
1310      $wp_filesystem->delete( $maintenance_file );
1311      $wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE );
1312
1313      /** This filter is documented in wp-admin/includes/update-core.php */
1314      apply_filters( 'update_feedback', __( 'Copying the required files&#8230;' ) );
1315
1316      // Copy new versions of WP files into place.
1317      $result = copy_dir( $from . $distro, $to, $skip );
1318
1319      if ( is_wp_error( $result ) ) {
1320           $result = new WP_Error(
1321                $result->get_error_code(),
1322                $result->get_error_message(),
1323                substr( $result->get_error_data(), strlen( $to ) )
 
Line Code
1445                               $result->get_error_message(),
1446                               substr( $result->get_error_data(), strlen( $wp_lang_dir ) )
1447                          );
1448                     }
1449                }
1450           }
1451      }
1452
1453      /** This filter is documented in wp-admin/includes/update-core.php */
1454      apply_filters( 'update_feedback', __( 'Disabling Maintenance mode&#8230;' ) );
1455
1456      // Remove maintenance file, we're done with potential site-breaking changes.
1457      $wp_filesystem->delete( $maintenance_file );
1458
1459      /*
1460       * 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users,
1461       * preventing installation of Twenty Twelve.
1462       */
1463      if ( '3.5' === $old_wp_version ) {
 
Line Code
1560
1561      // Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower.
1562      _upgrade_440_force_deactivate_incompatible_plugins();
1563
1564      // Deactivate incompatible plugins.
1565      _upgrade_core_deactivate_incompatible_plugins();
1566
1567      // Upgrade DB with separate request.
1568      /** This filter is documented in wp-admin/includes/update-core.php */
1569      apply_filters( 'update_feedback', __( 'Upgrading database&#8230;' ) );
1570
1571      $db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' );
1572      wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) );
1573
1574      // Clear the cache to prevent an update_option() from saving a stale db_version to the cache.
1575      wp_cache_flush();
1576      // Not all cache back ends listen to 'flush'.
1577      wp_cache_delete( 'alloptions', 'options' );
1578