Upgrade: Trigger the `upgrader_process_complete` action for translation updates.
This brings `Language_Pack_Upgrader` in line with the core, theme, and plugin upgrader. Props ronalfy. Fixes #36872. Built from https://develop.svn.wordpress.org/trunk@37687 git-svn-id: http://core.svn.wordpress.org/trunk@37653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1e48cc8a05
commit
bdd2199647
|
@ -222,6 +222,8 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
|||
if ( ! $wp_filesystem->mkdir( $remote_destination, FS_CHMOD_DIR ) )
|
||||
return new WP_Error( 'mkdir_failed_lang_dir', $this->strings['mkdir_failed'], $remote_destination );
|
||||
|
||||
$language_updates_results = array();
|
||||
|
||||
foreach ( $language_updates as $language_update ) {
|
||||
|
||||
$this->skin->language_update = $language_update;
|
||||
|
@ -252,10 +254,38 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
|||
$results[] = $this->result;
|
||||
|
||||
// Prevent credentials auth screen from displaying multiple times.
|
||||
if ( false === $result )
|
||||
if ( false === $result ) {
|
||||
break;
|
||||
}
|
||||
|
||||
$language_updates_results[] = array(
|
||||
'language' => $language_update->language,
|
||||
'type' => $language_update->type,
|
||||
'slug' => isset( $language_update->slug ) ? $language_update->slug : 'default',
|
||||
'version' => $language_update->version,
|
||||
);
|
||||
}
|
||||
|
||||
// Remove upgrade hooks which are not required for translation updates.
|
||||
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
|
||||
remove_action( 'upgrader_process_complete', 'wp_version_check' );
|
||||
remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
|
||||
remove_action( 'upgrader_process_complete', 'wp_update_themes' );
|
||||
|
||||
/** This action is documented in wp-admin/includes/class-wp-upgrader.php */
|
||||
do_action( 'upgrader_process_complete', $this, array(
|
||||
'action' => 'update',
|
||||
'type' => 'translation',
|
||||
'bulk' => true,
|
||||
'translations' => $language_updates_results
|
||||
) );
|
||||
|
||||
// Re-add upgrade hooks.
|
||||
add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
|
||||
add_action( 'upgrader_process_complete', 'wp_version_check' );
|
||||
add_action( 'upgrader_process_complete', 'wp_update_plugins' );
|
||||
add_action( 'upgrader_process_complete', 'wp_update_themes' );
|
||||
|
||||
$this->skin->bulk_footer();
|
||||
|
||||
$this->skin->footer();
|
||||
|
|
|
@ -762,17 +762,27 @@ class WP_Upgrader {
|
|||
*
|
||||
* @since 3.6.0
|
||||
* @since 3.7.0 Added to WP_Upgrader::run().
|
||||
* @since 4.6.0 `$translations` was added as a possible argument to `$hook_extra`.
|
||||
*
|
||||
* @param WP_Upgrader $this WP_Upgrader instance. In other contexts, $this, might be a
|
||||
* Theme_Upgrader, Plugin_Upgrader or Core_Upgrade instance.
|
||||
* Theme_Upgrader, Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader instance.
|
||||
* @param array $hook_extra {
|
||||
* Array of bulk item update data.
|
||||
*
|
||||
* @type string $action Type of action. Default 'update'.
|
||||
* @type string $type Type of update process. Accepts 'plugin', 'theme', or 'core'.
|
||||
* @type string $type Type of update process. Accepts 'plugin', 'theme', 'translation', or 'core'.
|
||||
* @type bool $bulk Whether the update process is a bulk update. Default true.
|
||||
* @type array $plugins Array of the basename paths of the plugins' main files.
|
||||
* @type array $themes The theme slugs.
|
||||
* @type array $translations {
|
||||
* Array of translations update data.
|
||||
*
|
||||
* @type string $language The locale the translation is for.
|
||||
* @type string $type Type of translation. Accepts 'plugin', 'theme', or 'core'.
|
||||
* @type string $slug Text domain the translation is for. The slug of a theme/plugin or
|
||||
* 'default' for core translations.
|
||||
* @type string $version The version of a theme, plugin, or core.
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
do_action( 'upgrader_process_complete', $this, $options['hook_extra'] );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-alpha-37686';
|
||||
$wp_version = '4.6-alpha-37687';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue