Summery Summery
Check that the package source contains a valid theme.
Syntax Syntax
Description Description
Hooked to the ‘upgrader_source_selection’ filter by Theme_Upgrader::install(). It will return an error if the theme doesn’t have style.css or index.php files.
Parameters Parameters
- $source
-
(Required) The full path to the package source.
Return Return
Source Source
File: wp-admin/includes/class-theme-upgrader.php
// Prevent credentials auth screen from displaying multiple times.
if ( false === $result ) {
break;
}
} // End foreach $themes.
$this->maintenance_mode( false );
// Refresh the Theme Update information.
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
do_action(
'upgrader_process_complete',
$this,
array(
'action' => 'update',
'type' => 'theme',
'bulk' => true,
'themes' => $themes,
)
);
$this->skin->bulk_footer();
$this->skin->footer();
// Cleanup our hooks, in case something else does a upgrade on this connection.
remove_filter( 'upgrader_pre_install', array( $this, 'current_before' ) );
remove_filter( 'upgrader_post_install', array( $this, 'current_after' ) );
remove_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ) );
// Ensure any future auto-update failures trigger a failure email by removing
// the last failure notification from the list when themes update successfully.
$past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() );
foreach ( $results as $theme => $result ) {
// Maintain last failure notification when themes failed to update manually.
if ( ! $result || is_wp_error( $result ) || ! isset( $past_failure_emails[ $theme ] ) ) {
continue;
}
unset( $past_failure_emails[ $theme ] );
}
update_option( 'auto_plugin_theme_update_emails', $past_failure_emails );
return $results;
}
/**
* Check that the package source contains a valid theme.
*
* Hooked to the {@see 'upgrader_source_selection'} filter by Theme_Upgrader::install().
* It will return an error if the theme doesn't have style.css or index.php
* files.
*
* @since 3.3.0
*
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |