mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Language Packs: Many many fixes such as:
- Add a "Update Translations" stand-alone button to the updates page - Shift Language feedback to before update process completion action links & limit the verbosity of output (name + success/errors) - Simplify/combine the language update descriptive string to only include a plugin/theme name - Properly handle cache clearing after language updates to prevent langs being repeditively updated - Display a "All items up to date" string when there's nothing to do - Reduce the 'Connection Information' from a <h2> to a <h3> to remove duplicate h2's and screen icons from update screens - Fix the Direct filesystem method not being used for Language updates because WP_LANG_DIR doesn't exist (check it's parent for writable instead) See #18200, #22704 Built from https://develop.svn.wordpress.org/trunk@25806 git-svn-id: http://core.svn.wordpress.org/trunk@25718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9fe39c464a
commit
1c8e79353a
@ -6636,6 +6636,14 @@ body.iframe {
|
|||||||
height: 98%;
|
height: 98%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Upgrader styles, Specific to Language Packs */
|
||||||
|
.lp-show-latest p {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.lp-show-latest p:last-child,
|
||||||
|
.lp-show-latest .lp-error p {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
/* - Only used once or twice in all of WP - deprecate for global style
|
/* - Only used once or twice in all of WP - deprecate for global style
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
2
wp-admin/css/wp-admin.min.css
vendored
2
wp-admin/css/wp-admin.min.css
vendored
File diff suppressed because one or more lines are too long
@ -528,6 +528,58 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translation Upgrader Skin for WordPress Translation Upgrades.
|
||||||
|
*
|
||||||
|
* @package WordPress
|
||||||
|
* @subpackage Upgrader
|
||||||
|
* @since 3.7.0
|
||||||
|
*/
|
||||||
|
class Language_Pack_Upgrader_Skin extends WP_Upgrader_Skin {
|
||||||
|
var $language_update = null;
|
||||||
|
var $done_header = false;
|
||||||
|
var $display_footer_actions = true;
|
||||||
|
|
||||||
|
function __construct( $args = array() ) {
|
||||||
|
$defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false );
|
||||||
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
if ( $args['skip_header_footer'] ) {
|
||||||
|
$this->done_header = true;
|
||||||
|
$this->display_footer_actions = false;
|
||||||
|
}
|
||||||
|
parent::__construct( $args );
|
||||||
|
}
|
||||||
|
|
||||||
|
function before() {
|
||||||
|
$name = $this->upgrader->get_name_for_update( $this->language_update );
|
||||||
|
|
||||||
|
echo '<div class="update-messages lp-show-latest">';
|
||||||
|
|
||||||
|
printf( '<h4>' . __( 'Updating translations for %1$s (%2$s)…' ) . '</h4>', $name, $this->language_update->language );
|
||||||
|
}
|
||||||
|
|
||||||
|
function error( $error ) {
|
||||||
|
echo '<div class="lp-error">';
|
||||||
|
parent::error( $error );
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function after() {
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function bulk_footer() {
|
||||||
|
$update_actions = array();
|
||||||
|
$update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" title="' . esc_attr__( 'Go to WordPress Updates page' ) . '" target="_parent">' . __( 'Return to WordPress Updates' ) . '</a>';
|
||||||
|
$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
|
||||||
|
|
||||||
|
if ( $update_actions && $this->display_footer_actions )
|
||||||
|
$this->feedback( implode( ' | ', $update_actions ) );
|
||||||
|
|
||||||
|
parent::footer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrader Skin for Automatic WordPress Upgrades
|
* Upgrader Skin for Automatic WordPress Upgrades
|
||||||
*
|
*
|
||||||
|
@ -307,14 +307,18 @@ class WP_Upgrader {
|
|||||||
$options = wp_parse_args($options, $defaults);
|
$options = wp_parse_args($options, $defaults);
|
||||||
extract($options);
|
extract($options);
|
||||||
|
|
||||||
//Connect to the Filesystem first.
|
|
||||||
$res = $this->fs_connect( array(WP_CONTENT_DIR, $destination) );
|
|
||||||
if ( ! $res ) //Mainly for non-connected filesystem.
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if ( ! $is_multi ) // call $this->header separately if running multiple times
|
if ( ! $is_multi ) // call $this->header separately if running multiple times
|
||||||
$this->skin->header();
|
$this->skin->header();
|
||||||
|
|
||||||
|
// Connect to the Filesystem first.
|
||||||
|
$res = $this->fs_connect( array(WP_CONTENT_DIR, $destination) );
|
||||||
|
// Mainly for non-connected filesystem.
|
||||||
|
if ( ! $res ) {
|
||||||
|
if ( ! $is_multi )
|
||||||
|
$this->skin->footer();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$this->skin->before();
|
$this->skin->before();
|
||||||
|
|
||||||
if ( is_wp_error($res) ) {
|
if ( is_wp_error($res) ) {
|
||||||
@ -368,8 +372,10 @@ class WP_Upgrader {
|
|||||||
|
|
||||||
$this->skin->after();
|
$this->skin->after();
|
||||||
|
|
||||||
if ( ! $is_multi )
|
if ( ! $is_multi ) {
|
||||||
|
do_action( 'upgrader_process_complete', $this, $hook_extra );
|
||||||
$this->skin->footer();
|
$this->skin->footer();
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -442,7 +448,10 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
'destination' => WP_PLUGIN_DIR,
|
'destination' => WP_PLUGIN_DIR,
|
||||||
'clear_destination' => false, // Do not overwrite files.
|
'clear_destination' => false, // Do not overwrite files.
|
||||||
'clear_working' => true,
|
'clear_working' => true,
|
||||||
'hook_extra' => array()
|
'hook_extra' => array(
|
||||||
|
'type' => 'plugin',
|
||||||
|
'action' => 'install',
|
||||||
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
remove_filter('upgrader_source_selection', array($this, 'check_package') );
|
remove_filter('upgrader_source_selection', array($this, 'check_package') );
|
||||||
@ -453,8 +462,6 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
// Force refresh of plugin update information
|
// Force refresh of plugin update information
|
||||||
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
||||||
|
|
||||||
do_action( 'upgrader_process_complete', $this, array( 'action' => 'install', 'type' => 'plugin' ), $package );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,7 +497,9 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
'clear_destination' => true,
|
'clear_destination' => true,
|
||||||
'clear_working' => true,
|
'clear_working' => true,
|
||||||
'hook_extra' => array(
|
'hook_extra' => array(
|
||||||
'plugin' => $plugin
|
'plugin' => $plugin,
|
||||||
|
'type' => 'plugin',
|
||||||
|
'action' => 'update',
|
||||||
),
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
@ -504,8 +513,6 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
// Force refresh of plugin update information
|
// Force refresh of plugin update information
|
||||||
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
||||||
|
|
||||||
do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin' ), $plugin );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,6 +594,13 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
|
|
||||||
$this->maintenance_mode(false);
|
$this->maintenance_mode(false);
|
||||||
|
|
||||||
|
do_action( 'upgrader_process_complete', $this, array(
|
||||||
|
'action' => 'update',
|
||||||
|
'type' => 'plugin',
|
||||||
|
'bulk' => true,
|
||||||
|
'plugins' => $plugins,
|
||||||
|
) );
|
||||||
|
|
||||||
$this->skin->bulk_footer();
|
$this->skin->bulk_footer();
|
||||||
|
|
||||||
$this->skin->footer();
|
$this->skin->footer();
|
||||||
@ -597,8 +611,6 @@ class Plugin_Upgrader extends WP_Upgrader {
|
|||||||
// Force refresh of plugin update information
|
// Force refresh of plugin update information
|
||||||
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
|
||||||
|
|
||||||
do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin', 'bulk' => true ), $plugins );
|
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,7 +826,11 @@ class Theme_Upgrader extends WP_Upgrader {
|
|||||||
'package' => $package,
|
'package' => $package,
|
||||||
'destination' => get_theme_root(),
|
'destination' => get_theme_root(),
|
||||||
'clear_destination' => false, //Do not overwrite files.
|
'clear_destination' => false, //Do not overwrite files.
|
||||||
'clear_working' => true
|
'clear_working' => true,
|
||||||
|
'hook_extra' => array(
|
||||||
|
'type' => 'theme',
|
||||||
|
'action' => 'install',
|
||||||
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
remove_filter('upgrader_source_selection', array($this, 'check_package') );
|
remove_filter('upgrader_source_selection', array($this, 'check_package') );
|
||||||
@ -826,8 +842,6 @@ class Theme_Upgrader extends WP_Upgrader {
|
|||||||
// Refresh the Theme Update information
|
// Refresh the Theme Update information
|
||||||
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
|
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
|
||||||
|
|
||||||
do_action( 'upgrader_process_complete', $this, array( 'action' => 'install', 'type' => 'theme' ), $package );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +877,9 @@ class Theme_Upgrader extends WP_Upgrader {
|
|||||||
'clear_destination' => true,
|
'clear_destination' => true,
|
||||||
'clear_working' => true,
|
'clear_working' => true,
|
||||||
'hook_extra' => array(
|
'hook_extra' => array(
|
||||||
'theme' => $theme
|
'theme' => $theme,
|
||||||
|
'type' => 'theme',
|
||||||
|
'action' => 'update',
|
||||||
),
|
),
|
||||||
) );
|
) );
|
||||||
|
|
||||||
@ -876,8 +892,6 @@ class Theme_Upgrader extends WP_Upgrader {
|
|||||||
|
|
||||||
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
|
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
|
||||||
|
|
||||||
do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme' ), $theme );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,6 +973,13 @@ class Theme_Upgrader extends WP_Upgrader {
|
|||||||
|
|
||||||
$this->maintenance_mode(false);
|
$this->maintenance_mode(false);
|
||||||
|
|
||||||
|
do_action( 'upgrader_process_complete', $this, array(
|
||||||
|
'action' => 'update',
|
||||||
|
'type' => 'plugin',
|
||||||
|
'bulk' => true,
|
||||||
|
'themes' => $themes,
|
||||||
|
) );
|
||||||
|
|
||||||
$this->skin->bulk_footer();
|
$this->skin->bulk_footer();
|
||||||
|
|
||||||
$this->skin->footer();
|
$this->skin->footer();
|
||||||
@ -971,8 +992,6 @@ class Theme_Upgrader extends WP_Upgrader {
|
|||||||
// Refresh the Theme Update information
|
// Refresh the Theme Update information
|
||||||
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
|
wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
|
||||||
|
|
||||||
do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme', 'bulk' => true ), $themes );
|
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1073,18 +1092,27 @@ class Theme_Upgrader extends WP_Upgrader {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20, 3 );
|
add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
|
||||||
class Language_Pack_Upgrader extends WP_Upgrader {
|
class Language_Pack_Upgrader extends WP_Upgrader {
|
||||||
|
|
||||||
var $result;
|
var $result;
|
||||||
var $bulk = true;
|
var $bulk = true;
|
||||||
|
|
||||||
static function async_upgrade( $upgrader, $context, $package ) {
|
static function async_upgrade( $upgrader = false ) {
|
||||||
// Avoid recursion.
|
// Avoid recursion.
|
||||||
if ( $upgrader instanceof Language_Pack_Upgrader )
|
if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$lp_upgrader = new Language_Pack_Upgrader( new Headerless_Upgrader_Skin() );
|
// Nothing to do?
|
||||||
|
$language_updates = wp_get_translation_updates();
|
||||||
|
if ( ! $language_updates )
|
||||||
|
return;
|
||||||
|
|
||||||
|
$skin = new Language_Pack_Upgrader_Skin( array(
|
||||||
|
'skip_header_footer' => true,
|
||||||
|
) );
|
||||||
|
|
||||||
|
$lp_upgrader = new Language_Pack_Upgrader( $skin );
|
||||||
$lp_upgrader->upgrade();
|
$lp_upgrader->upgrade();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1098,24 +1126,37 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
|||||||
$this->strings['process_success'] = __( 'Translation updated successfully.' );
|
$this->strings['process_success'] = __( 'Translation updated successfully.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade( $update = false ) {
|
function upgrade( $update = false, $args = array() ) {
|
||||||
if ( $update )
|
if ( $update )
|
||||||
$update = array( $update );
|
$update = array( $update );
|
||||||
$results = $this->bulk_upgrade( $update );
|
$results = $this->bulk_upgrade( $update, $args );
|
||||||
return $results[0];
|
return $results[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
function bulk_upgrade( $language_updates = array() ) {
|
function bulk_upgrade( $language_updates = array(), $args = array() ) {
|
||||||
global $wp_filesystem;
|
global $wp_filesystem;
|
||||||
|
|
||||||
|
$defaults = array(
|
||||||
|
'clear_update_cache' => true,
|
||||||
|
);
|
||||||
|
$parsed_args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
$this->init();
|
$this->init();
|
||||||
$this->upgrade_strings();
|
$this->upgrade_strings();
|
||||||
|
|
||||||
if ( ! $language_updates )
|
if ( ! $language_updates )
|
||||||
$language_updates = wp_get_translation_updates();
|
$language_updates = wp_get_translation_updates();
|
||||||
|
|
||||||
if ( empty( $language_updates ) )
|
if ( empty( $language_updates ) ) {
|
||||||
|
$this->skin->header();
|
||||||
|
$this->skin->before();
|
||||||
|
$this->skin->set_result( true );
|
||||||
|
$this->skin->feedback( 'up_to_date' );
|
||||||
|
$this->skin->after();
|
||||||
|
$this->skin->bulk_footer();
|
||||||
|
$this->skin->footer();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ( 'upgrader_process_complete' == current_filter() )
|
if ( 'upgrader_process_complete' == current_filter() )
|
||||||
$this->skin->feedback( 'starting_upgrade' );
|
$this->skin->feedback( 'starting_upgrade' );
|
||||||
@ -1145,6 +1186,8 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
|||||||
|
|
||||||
foreach ( $language_updates as $language_update ) {
|
foreach ( $language_updates as $language_update ) {
|
||||||
|
|
||||||
|
$this->skin->language_update = $language_update;
|
||||||
|
|
||||||
$destination = WP_LANG_DIR;
|
$destination = WP_LANG_DIR;
|
||||||
if ( 'plugin' == $language_update->type )
|
if ( 'plugin' == $language_update->type )
|
||||||
$destination .= '/plugins';
|
$destination .= '/plugins';
|
||||||
@ -1175,9 +1218,19 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->skin->bulk_footer();
|
||||||
|
|
||||||
|
$this->skin->footer();
|
||||||
|
|
||||||
// Clean up our hooks, in case something else does an upgrade on this connection.
|
// Clean up our hooks, in case something else does an upgrade on this connection.
|
||||||
remove_filter( 'upgrader_source_selection', array( &$this, 'check_package' ), 10, 2 );
|
remove_filter( 'upgrader_source_selection', array( &$this, 'check_package' ), 10, 2 );
|
||||||
|
|
||||||
|
if ( $parsed_args['clear_update_cache'] ) {
|
||||||
|
wp_clean_themes_cache( true );
|
||||||
|
wp_clean_plugins_cache( true );
|
||||||
|
delete_site_transient( 'update_core' );
|
||||||
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1206,6 +1259,26 @@ class Language_Pack_Upgrader extends WP_Upgrader {
|
|||||||
return $source;
|
return $source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_name_for_update( $update ) {
|
||||||
|
switch ( $update->type ) {
|
||||||
|
case 'core':
|
||||||
|
return 'WordPress'; // Not translated
|
||||||
|
break;
|
||||||
|
case 'theme':
|
||||||
|
$theme = wp_get_theme( $update->slug );
|
||||||
|
if ( $theme->exists() )
|
||||||
|
return $theme->Get( 'Name' );
|
||||||
|
break;
|
||||||
|
case 'plugin':
|
||||||
|
$plugin_data = get_plugins( '/' . $update->slug );
|
||||||
|
$plugin_data = array_shift( $plugin_data );
|
||||||
|
if ( $plugin_data )
|
||||||
|
return $plugin_data['Name'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1321,7 +1394,6 @@ class Core_Upgrader extends WP_Upgrader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ), $result );
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1628,42 +1700,8 @@ class WP_Automatic_Upgrader {
|
|||||||
$skin->feedback( __( 'Updating plugin: %s' ), $item_name );
|
$skin->feedback( __( 'Updating plugin: %s' ), $item_name );
|
||||||
break;
|
break;
|
||||||
case 'language':
|
case 'language':
|
||||||
if ( 'theme' == $item->type ) {
|
$name = $upgrader->get_name_for_update( $item );
|
||||||
$theme = wp_get_theme( $item->slug );
|
$skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)…' ), $name, $item->language ) );
|
||||||
$skin->feedback( sprintf(
|
|
||||||
__( 'Updating the %1$s translation for the %2$s theme' ),
|
|
||||||
$item->language,
|
|
||||||
$theme->Get( 'Name' )
|
|
||||||
) );
|
|
||||||
$item_name = sprintf(
|
|
||||||
__( '%1$s translation for the %2$s theme' ),
|
|
||||||
$item->language,
|
|
||||||
$theme->Get( 'Name' )
|
|
||||||
);
|
|
||||||
} elseif ( 'plugin' == $item->type ) {
|
|
||||||
$plugin_data = get_plugins( '/' . $item->slug );
|
|
||||||
$plugin_data = array_shift( $plugin_data );
|
|
||||||
$skin->feedback( sprintf(
|
|
||||||
__( 'Updating the %1$s translation for the %2$s plugin' ),
|
|
||||||
$item->language,
|
|
||||||
$plugin_data['Name']
|
|
||||||
) );
|
|
||||||
$item_name = sprintf(
|
|
||||||
__( '%1$s translation for the %2$s plugin' ),
|
|
||||||
$item->language,
|
|
||||||
$plugin_data['Name']
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$skin->feedback( sprintf(
|
|
||||||
__( 'Updating %s translation' ),
|
|
||||||
$item->language
|
|
||||||
) );
|
|
||||||
$item_name = sprintf(
|
|
||||||
__( '%s translation' ),
|
|
||||||
$item->language
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1711,7 +1749,7 @@ class WP_Automatic_Upgrader {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Don't automatically run these thins, as we'll handle it ourselves
|
// Don't automatically run these thins, as we'll handle it ourselves
|
||||||
remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20, 3 );
|
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_version_check' );
|
||||||
remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
|
remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
|
||||||
remove_action( 'upgrader_process_complete', 'wp_update_themes' );
|
remove_action( 'upgrader_process_complete', 'wp_update_themes' );
|
||||||
|
@ -891,6 +891,11 @@ function get_filesystem_method($args = array(), $context = false) {
|
|||||||
if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
|
if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
|
||||||
if ( !$context )
|
if ( !$context )
|
||||||
$context = WP_CONTENT_DIR;
|
$context = WP_CONTENT_DIR;
|
||||||
|
|
||||||
|
// If the directory doesn't exist (wp-content/languages) then use the parent directory as we'll create it.
|
||||||
|
if ( WP_LANG_DIR == $context && ! is_dir( $context ) )
|
||||||
|
$context = dirname( $context );
|
||||||
|
|
||||||
$context = trailingslashit($context);
|
$context = trailingslashit($context);
|
||||||
$temp_file_name = $context . 'temp-write-test-' . time();
|
$temp_file_name = $context . 'temp-write-test-' . time();
|
||||||
$temp_handle = @fopen($temp_file_name, 'w');
|
$temp_handle = @fopen($temp_file_name, 'w');
|
||||||
@ -1021,9 +1026,8 @@ jQuery(function($){
|
|||||||
-->
|
-->
|
||||||
</script>
|
</script>
|
||||||
<form action="<?php echo esc_url( $form_post ) ?>" method="post">
|
<form action="<?php echo esc_url( $form_post ) ?>" method="post">
|
||||||
<div class="wrap">
|
<div>
|
||||||
<?php screen_icon(); ?>
|
<h3><?php _e('Connection Information') ?></h3>
|
||||||
<h2><?php _e('Connection Information') ?></h2>
|
|
||||||
<p><?php
|
<p><?php
|
||||||
$label_user = __('Username');
|
$label_user = __('Username');
|
||||||
$label_pass = __('Password');
|
$label_pass = __('Password');
|
||||||
|
@ -889,6 +889,9 @@ function update_core($from, $to) {
|
|||||||
// Remove maintenance file, we're done.
|
// Remove maintenance file, we're done.
|
||||||
$wp_filesystem->delete($maintenance_file);
|
$wp_filesystem->delete($maintenance_file);
|
||||||
|
|
||||||
|
// Has to be in here, rather than the Upgrader as the filter below will override and kill the process before themes get updated on major updates
|
||||||
|
do_action( 'upgrader_process_complete', null, array( 'action' => 'update', 'type' => 'core' ) );
|
||||||
|
|
||||||
// If we made it this far:
|
// If we made it this far:
|
||||||
do_action( '_core_updated_successfully', $wp_version );
|
do_action( '_core_updated_successfully', $wp_version );
|
||||||
|
|
||||||
|
@ -324,6 +324,27 @@ function list_theme_updates() {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function list_translation_updates() {
|
||||||
|
$updates = wp_get_translation_updates();
|
||||||
|
if ( ! $updates ) {
|
||||||
|
if ( 'en_US' != get_locale() ) {
|
||||||
|
echo '<h3>' . __( 'Translations' ) . '</h3>';
|
||||||
|
echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$form_action = 'update-core.php?action=do-translation-upgrade';
|
||||||
|
?>
|
||||||
|
<h3><?php _e( 'Translations' ); ?></h3>
|
||||||
|
<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
|
||||||
|
<p><?php _e( 'Some of your translations are out of date.' ); ?></p>
|
||||||
|
<?php wp_nonce_field('upgrade-translations'); ?>
|
||||||
|
<p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upgrade WordPress core display.
|
* Upgrade WordPress core display.
|
||||||
*
|
*
|
||||||
@ -341,8 +362,6 @@ function do_core_upgrade( $reinstall = false ) {
|
|||||||
else
|
else
|
||||||
$url = 'update-core.php?action=do-core-upgrade';
|
$url = 'update-core.php?action=do-core-upgrade';
|
||||||
$url = wp_nonce_url($url, 'upgrade-core');
|
$url = wp_nonce_url($url, 'upgrade-core');
|
||||||
if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
$version = isset( $_POST['version'] )? $_POST['version'] : false;
|
$version = isset( $_POST['version'] )? $_POST['version'] : false;
|
||||||
$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
|
$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
|
||||||
@ -350,15 +369,24 @@ function do_core_upgrade( $reinstall = false ) {
|
|||||||
if ( !$update )
|
if ( !$update )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! WP_Filesystem($credentials, ABSPATH) ) {
|
|
||||||
request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<?php screen_icon('tools'); ?>
|
<?php screen_icon('tools'); ?>
|
||||||
<h2><?php _e('Update WordPress'); ?></h2>
|
<h2><?php _e('Update WordPress'); ?></h2>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH ) ) ) {
|
||||||
|
echo '</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! WP_Filesystem( $credentials, ABSPATH ) ) {
|
||||||
|
// Failed to connect, Error and request again
|
||||||
|
request_filesystem_credentials( $url, '', true, ABSPATH );
|
||||||
|
echo '</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( $wp_filesystem->errors->get_error_code() ) {
|
if ( $wp_filesystem->errors->get_error_code() ) {
|
||||||
foreach ( $wp_filesystem->errors->get_error_messages() as $message )
|
foreach ( $wp_filesystem->errors->get_error_messages() as $message )
|
||||||
show_message($message);
|
show_message($message);
|
||||||
@ -477,12 +505,15 @@ if ( 'upgrade-core' == $action ) {
|
|||||||
echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>';
|
echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>';
|
||||||
echo '</p>';
|
echo '</p>';
|
||||||
|
|
||||||
if ( current_user_can( 'update_core' ) )
|
if ( $core = current_user_can( 'update_core' ) )
|
||||||
core_upgrade_preamble();
|
core_upgrade_preamble();
|
||||||
if ( current_user_can( 'update_plugins' ) )
|
if ( $plugins = current_user_can( 'update_plugins' ) )
|
||||||
list_plugin_updates();
|
list_plugin_updates();
|
||||||
if ( current_user_can( 'update_themes' ) )
|
if ( $themes = current_user_can( 'update_themes' ) )
|
||||||
list_theme_updates();
|
list_theme_updates();
|
||||||
|
if ( $core || $plugins || $themes )
|
||||||
|
list_translation_updates();
|
||||||
|
unset( $core, $plugins, $themes );
|
||||||
do_action('core_upgrade_preamble');
|
do_action('core_upgrade_preamble');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||||
@ -570,6 +601,26 @@ if ( 'upgrade-core' == $action ) {
|
|||||||
echo '</div>';
|
echo '</div>';
|
||||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||||
|
|
||||||
|
} elseif ( 'do-translation-upgrade' == $action ) {
|
||||||
|
|
||||||
|
if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )
|
||||||
|
wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
|
||||||
|
|
||||||
|
check_admin_referer( 'upgrade-translations' );
|
||||||
|
|
||||||
|
require_once( ABSPATH . 'wp-admin/admin-header.php' );
|
||||||
|
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
||||||
|
|
||||||
|
$url = 'update-core.php?action=do-translation-upgrade';
|
||||||
|
$nonce = 'upgrade-translations';
|
||||||
|
$title = __( 'Update Translations' );
|
||||||
|
$context = WP_LANG_DIR;
|
||||||
|
|
||||||
|
$upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
|
||||||
|
$result = $upgrader->bulk_upgrade();
|
||||||
|
|
||||||
|
require_once( ABSPATH . 'wp-admin/admin-footer.php' );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
do_action('update-core-custom_' . $action);
|
do_action('update-core-custom_' . $action);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user