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
1080       * 2. Before Maintenance Mode is enabled.
1081       * 3. Before WordPress begins copying over the necessary files.
1082       * 4. Before Maintenance Mode is disabled.
1083       * 5. Before the database is upgraded.
1084       *
1085       * @since 2.5.0
1086       *
1087       * @param string $feedback The core update feedback messages.
1088       */
1089      apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) );
1090
1091      // Sanity check the unzipped distribution.
1092      $distro = '';
1093      $roots  = array( '/wordpress/', '/wordpress-mu/' );
1094
1095      foreach ( $roots as $root ) {
1096           if ( $wp_filesystem->exists( $from . $root . 'readme.html' )
1097                && $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' )
1098           ) {
 
Line Code
1222                     /* translators: 1: WordPress version number, 2: The PHP extension name needed. */
1223                     __( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP extension.' ),
1224                     $wp_version,
1225                     'JSON'
1226                )
1227           );
1228      }
1229
1230      /** This filter is documented in wp-admin/includes/update-core.php */
1231      apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );
1232
1233      /*
1234       * Don't copy wp-content, we'll deal with that below.
1235       * We also copy version.php last so failed updates report their old version.
1236       */
1237      $skip              = array( 'wp-content', 'wp-includes/version.php' );
1238      $check_is_writable = array();
1239
1240      // Check to see which files don't really need updating - only available for 3.7 and higher.
 
Line Code
1306                          'files_not_writable',
1307                          __( 'The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.' ),
1308                          implode( ', ', $error_data )
1309                     );
1310                }
1311           }
1312      }
1313
1314      /** This filter is documented in wp-admin/includes/update-core.php */
1315      apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) );
1316
1317      // Create maintenance file to signal that we are upgrading.
1318      $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
1319      $maintenance_file   = $to . '.maintenance';
1320      $wp_filesystem->delete( $maintenance_file );
1321      $wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE );
1322
1323      /** This filter is documented in wp-admin/includes/update-core.php */
1324      apply_filters( 'update_feedback', __( 'Copying the required files&#8230;' ) );
1325
1326      // Copy new versions of WP files into place.
1327      $result = copy_dir( $from . $distro, $to, $skip );
1328
1329      if ( is_wp_error( $result ) ) {
1330           $result = new WP_Error(
1331                $result->get_error_code(),
1332                $result->get_error_message(),
1333                substr( $result->get_error_data(), strlen( $to ) )
 
Line Code
1451                               $result->get_error_message(),
1452                               substr( $result->get_error_data(), strlen( $wp_lang_dir ) )
1453                          );
1454                     }
1455                }
1456           }
1457      }
1458
1459      /** This filter is documented in wp-admin/includes/update-core.php */
1460      apply_filters( 'update_feedback', __( 'Disabling Maintenance mode&#8230;' ) );
1461
1462      // Remove maintenance file, we're done with potential site-breaking changes.
1463      $wp_filesystem->delete( $maintenance_file );
1464
1465      /*
1466       * 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users,
1467       * preventing installation of Twenty Twelve.
1468       */
1469      if ( '3.5' === $old_wp_version ) {
 
Line Code
1566
1567      // Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower.
1568      _upgrade_440_force_deactivate_incompatible_plugins();
1569
1570      // Deactivate incompatible plugins.
1571      _upgrade_core_deactivate_incompatible_plugins();
1572
1573      // Upgrade DB with separate request.
1574      /** This filter is documented in wp-admin/includes/update-core.php */
1575      apply_filters( 'update_feedback', __( 'Upgrading database&#8230;' ) );
1576
1577      $db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' );
1578      wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) );
1579
1580      // Clear the cache to prevent an update_option() from saving a stale db_version to the cache.
1581      wp_cache_flush();
1582      // Not all cache back ends listen to 'flush'.
1583      wp_cache_delete( 'alloptions', 'options' );
1584