WordPress Hooks Explorer

Listing all hooks extracted WordPress Core


Details about update_feedback

Back to home

Files

Filename Hook Type Line Number PHP Doc
wp-admin/includes/update-core.php apply_filters 986 /**
* Filters feedback messages displayed during the core update process.
*
* The filter is first evaluated after the zip file for the latest version
* has been downloaded and unzipped. It is evaluated five more times during
* the process:
*
* 1. Before WordPress begins the core upgrade process.
* 2. Before Maintenance Mode is enabled.
* 3. Before WordPress begins copying over the necessary files.
* 4. Before Maintenance Mode is disabled.
* 5. Before the database is upgraded.
*
* @since 2.5.0
*
* @param string $feedback The core update feedback messages.
*/
wp-admin/includes/update-core.php apply_filters 1123 /**
* Filters feedback messages displayed during the core update process.
*
* The filter is first evaluated after the zip file for the latest version
* has been downloaded and unzipped. It is evaluated five more times during
* the process:
*
* 1. Before WordPress begins the core upgrade process.
* 2. Before Maintenance Mode is enabled.
* 3. Before WordPress begins copying over the necessary files.
* 4. Before Maintenance Mode is disabled.
* 5. Before the database is upgraded.
*
* @since 2.5.0
*
* @param string $feedback The core update feedback messages.
*/
apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) );

// Sanity check the unzipped distribution.
$distro = '';
$roots = array( '/wordpress/', '/wordpress-mu/' );

foreach ( $roots as $root ) {
if ( $wp_filesystem->exists( $from . $root . 'readme.html' )
&& $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' )
) {
$distro = $root;
break;
}
}

if ( ! $distro ) {
$wp_filesystem->delete( $from, true );

return new WP_Error( 'insane_distro', __( 'The update could not be unpacked' ) );
}

/*
* Import $wp_version, $required_php_version, and $required_mysql_version from the new version.
* DO NOT globalize any variables imported from `version-current.php` in this function.
*
* BC Note: $wp_filesystem->wp_content_dir() returned unslashed pre-2.8.
*/
$versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php';

if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) {
$wp_filesystem->delete( $from, true );

return new WP_Error(
'copy_failed_for_version_file',
__( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ),
'wp-includes/version.php'
);
}

$wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );

/*
* `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
* so don't run it when upgrading from older versions.
*/
wp-admin/includes/update-core.php apply_filters 1200 /**
* Filters feedback messages displayed during the core update process.
*
* The filter is first evaluated after the zip file for the latest version
* has been downloaded and unzipped. It is evaluated five more times during
* the process:
*
* 1. Before WordPress begins the core upgrade process.
* 2. Before Maintenance Mode is enabled.
* 3. Before WordPress begins copying over the necessary files.
* 4. Before Maintenance Mode is disabled.
* 5. Before the database is upgraded.
*
* @since 2.5.0
*
* @param string $feedback The core update feedback messages.
*/
apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) );

// Sanity check the unzipped distribution.
$distro = '';
$roots = array( '/wordpress/', '/wordpress-mu/' );

foreach ( $roots as $root ) {
if ( $wp_filesystem->exists( $from . $root . 'readme.html' )
&& $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' )
) {
$distro = $root;
break;
}
}

if ( ! $distro ) {
$wp_filesystem->delete( $from, true );

return new WP_Error( 'insane_distro', __( 'The update could not be unpacked' ) );
}

/*
* Import $wp_version, $required_php_version, and $required_mysql_version from the new version.
* DO NOT globalize any variables imported from `version-current.php` in this function.
*
* BC Note: $wp_filesystem->wp_content_dir() returned unslashed pre-2.8.
*/
$versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php';

if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) {
$wp_filesystem->delete( $from, true );

return new WP_Error(
'copy_failed_for_version_file',
__( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ),
'wp-includes/version.php'
);
}

$wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );

/*
* `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
* so don't run it when upgrading from older versions.
*/
wp-admin/includes/update-core.php apply_filters 1209 /**
* Filters feedback messages displayed during the core update process.
*
* The filter is first evaluated after the zip file for the latest version
* has been downloaded and unzipped. It is evaluated five more times during
* the process:
*
* 1. Before WordPress begins the core upgrade process.
* 2. Before Maintenance Mode is enabled.
* 3. Before WordPress begins copying over the necessary files.
* 4. Before Maintenance Mode is disabled.
* 5. Before the database is upgraded.
*
* @since 2.5.0
*
* @param string $feedback The core update feedback messages.
*/
apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) );

// Sanity check the unzipped distribution.
$distro = '';
$roots = array( '/wordpress/', '/wordpress-mu/' );

foreach ( $roots as $root ) {
if ( $wp_filesystem->exists( $from . $root . 'readme.html' )
&& $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' )
) {
$distro = $root;
break;
}
}

if ( ! $distro ) {
$wp_filesystem->delete( $from, true );

return new WP_Error( 'insane_distro', __( 'The update could not be unpacked' ) );
}

/*
* Import $wp_version, $required_php_version, and $required_mysql_version from the new version.
* DO NOT globalize any variables imported from `version-current.php` in this function.
*
* BC Note: $wp_filesystem->wp_content_dir() returned unslashed pre-2.8.
*/
$versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php';

if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) {
$wp_filesystem->delete( $from, true );

return new WP_Error(
'copy_failed_for_version_file',
__( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ),
'wp-includes/version.php'
);
}

$wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );

/*
* `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
* so don't run it when upgrading from older versions.
*/
wp-admin/includes/update-core.php apply_filters 1336 /** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Copying the required files…' ) );

// Copy new versions of WP files into place.
$result = copy_dir( $from . $distro, $to, $skip );

if ( is_wp_error( $result ) ) {
$result = new WP_Error(
$result->get_error_code(),
$result->get_error_message(),
substr( $result->get_error_data(), strlen( $to ) )
);
}

// Since we know the core files have copied over, we can now copy the version file.
if ( ! is_wp_error( $result ) ) {
if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) {
$wp_filesystem->delete( $from, true );
$result = new WP_Error(
'copy_failed_for_version_file',
__( 'The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.' ),
'wp-includes/version.php'
);
}

$wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );

/*
* `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
* so don't run it when upgrading from older versions.
*/
wp-admin/includes/update-core.php apply_filters 1446 /** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) );

// Remove maintenance file, we're done with potential site-breaking changes.
$wp_filesystem->delete( $maintenance_file );

// 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users,
// preventing installation of Twenty Twelve.
if ( '3.5' === $old_wp_version ) {
if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' )
&& ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' )
) {
$wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' );
}
}

/*
* Copy new bundled plugins & themes.
* This gives us the ability to install new plugins & themes bundled with
* future versions of WordPress whilst avoiding the re-install upon upgrade issue.
* $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated.
*/
wp-admin/includes/class-core-upgrader.php apply_filters 131 /**
* Upgrade WordPress core.
*
* @since 2.8.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
* @global callable $_wp_filesystem_direct_method
*
* @param object $current Response object for whether WordPress is current.
* @param array $args {
* Optional. Arguments for upgrading WordPress core. Default empty array.
*
* @type bool $pre_check_md5 Whether to check the file checksums before
* attempting the upgrade. Default true.
* @type bool $attempt_rollback Whether to attempt to rollback the chances if
* there is a problem. Default false.
* @type bool $do_rollback Whether to perform this "upgrade" as a rollback.
* Default false.
* }
* @return string|false|WP_Error New WordPress version on success, false or WP_Error on failure.
*/
public function upgrade( $current, $args = array() ) {
global $wp_filesystem;

require ABSPATH . WPINC . '/version.php'; // $wp_version;

$start_time = time();

$defaults = array(
'pre_check_md5' => true,
'attempt_rollback' => false,
'do_rollback' => false,
'allow_relaxed_file_ownership' => false,
);
$parsed_args = wp_parse_args( $args, $defaults );

$this->init();
$this->upgrade_strings();

// Is an update available?
if ( ! isset( $current->response ) || 'latest' === $current->response ) {
return new WP_Error( 'up_to_date', $this->strings['up_to_date'] );
}

$res = $this->fs_connect( array( ABSPATH, WP_CONTENT_DIR ), $parsed_args['allow_relaxed_file_ownership'] );
if ( ! $res || is_wp_error( $res ) ) {
return $res;
}

$wp_dir = trailingslashit( $wp_filesystem->abspath() );

$partial = true;
if ( $parsed_args['do_rollback'] ) {
$partial = false;
} elseif ( $parsed_args['pre_check_md5'] && ! $this->check_files() ) {
$partial = false;
}

/*
* If partial update is returned from the API, use that, unless we're doing
* a reinstallation. If we cross the new_bundled version number, then use
* the new_bundled zip. Don't though if the constant is set to skip bundled items.
* If the API returns a no_content zip, go with it. Finally, default to the full zip.
*/
wp-admin/includes/class-core-upgrader.php apply_filters 195 /** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', $download->get_error_message() );

// Report this failure back to WordPress.org for debugging purposes.
wp_version_check(
array(
'signature_failure_code' => $download->get_error_code(),
'signature_failure_data' => $download->get_error_data(),
)
);

// Pretend this error didn't happen.
$download = $download->get_error_data( 'softfail-filename' );
}

if ( is_wp_error( $download ) ) {
WP_Upgrader::release_lock( 'core_updater' );
return $download;
}

$working_dir = $this->unpack_package( $download );
if ( is_wp_error( $working_dir ) ) {
WP_Upgrader::release_lock( 'core_updater' );
return $working_dir;
}

// Copy update-core.php from the new version into place.
if ( ! $wp_filesystem->copy( $working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true ) ) {
$wp_filesystem->delete( $working_dir, true );
WP_Upgrader::release_lock( 'core_updater' );
return new WP_Error( 'copy_failed_for_update_core_file', __( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' );
}
$wp_filesystem->chmod( $wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE );

wp_opcache_invalidate( ABSPATH . 'wp-admin/includes/update-core.php' );
require_once ABSPATH . 'wp-admin/includes/update-core.php';

if ( ! function_exists( 'update_core' ) ) {
WP_Upgrader::release_lock( 'core_updater' );
return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] );
}

$result = update_core( $working_dir, $wp_dir );

// In the event of an issue, we may be able to roll back.
if ( $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) {
$try_rollback = false;
if ( is_wp_error( $result ) ) {
$error_code = $result->get_error_code();
/*
* Not all errors are equal. These codes are critical: copy_failed__copy_dir,
* mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full.
* do_rollback allows for update_core() to trigger a rollback if needed.
*/
wp-admin/includes/class-core-upgrader.php apply_filters 198 /** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', $download->get_error_message() );

// Report this failure back to WordPress.org for debugging purposes.
wp_version_check(
array(
'signature_failure_code' => $download->get_error_code(),
'signature_failure_data' => $download->get_error_data(),
)
);

// Pretend this error didn't happen.
$download = $download->get_error_data( 'softfail-filename' );
}

if ( is_wp_error( $download ) ) {
WP_Upgrader::release_lock( 'core_updater' );
return $download;
}

$working_dir = $this->unpack_package( $download );
if ( is_wp_error( $working_dir ) ) {
WP_Upgrader::release_lock( 'core_updater' );
return $working_dir;
}

// Copy update-core.php from the new version into place.
if ( ! $wp_filesystem->copy( $working_dir . '/wordpress/wp-admin/includes/update-core.php', $wp_dir . 'wp-admin/includes/update-core.php', true ) ) {
$wp_filesystem->delete( $working_dir, true );
WP_Upgrader::release_lock( 'core_updater' );
return new WP_Error( 'copy_failed_for_update_core_file', __( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ), 'wp-admin/includes/update-core.php' );
}
$wp_filesystem->chmod( $wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE );

wp_opcache_invalidate( ABSPATH . 'wp-admin/includes/update-core.php' );
require_once ABSPATH . 'wp-admin/includes/update-core.php';

if ( ! function_exists( 'update_core' ) ) {
WP_Upgrader::release_lock( 'core_updater' );
return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] );
}

$result = update_core( $working_dir, $wp_dir );

// In the event of an issue, we may be able to roll back.
if ( $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) {
$try_rollback = false;
if ( is_wp_error( $result ) ) {
$error_code = $result->get_error_code();
/*
* Not all errors are equal. These codes are critical: copy_failed__copy_dir,
* mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full.
* do_rollback allows for update_core() to trigger a rollback if needed.
*/

Hook Parameters

Parameter Type Name Description
string $feedback The core update feedback messages.
string $feedback The core update feedback messages.
string $feedback The core update feedback messages.
string $feedback The core update feedback messages.
string $feedback The core update feedback messages.
string $feedback The core update feedback messages.