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