<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[25806] trunk/src/wp-admin: Language Packs: Many many fixes such as:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/25806">25806</a></dd>
<dt>Author</dt> <dd>dd32</dd>
<dt>Date</dt> <dd>2013-10-16 04:14:29 +0000 (Wed, 16 Oct 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>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 <a href="http://core.trac.wordpress.org/ticket/18200">#18200</a>, <a href="http://core.trac.wordpress.org/ticket/22704">#22704</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsswpadmincss">trunk/src/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunksrcwpadminincludesclasswpupgraderskinsphp">trunk/src/wp-admin/includes/class-wp-upgrader-skins.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpupgraderphp">trunk/src/wp-admin/includes/class-wp-upgrader.php</a></li>
<li><a href="#trunksrcwpadminincludesfilephp">trunk/src/wp-admin/includes/file.php</a></li>
<li><a href="#trunksrcwpadminincludesupdatecorephp">trunk/src/wp-admin/includes/update-core.php</a></li>
<li><a href="#trunksrcwpadminupdatecorephp">trunk/src/wp-admin/update-core.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsswpadmincss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/wp-admin.css (25805 => 25806)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/wp-admin.css 2013-10-16 04:01:12 UTC (rev 25805)
+++ trunk/src/wp-admin/css/wp-admin.css 2013-10-16 04:14:29 UTC (rev 25806)
</span><span class="lines">@@ -6636,6 +6636,14 @@
</span><span class="cx"> height: 98%;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/* 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;
+}
</ins><span class="cx">
</span><span class="cx"> /* - Only used once or twice in all of WP - deprecate for global style
</span><span class="cx"> ------------------------------------------------------------------------------*/
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpupgraderskinsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-upgrader-skins.php (25805 => 25806)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-upgrader-skins.php 2013-10-16 04:01:12 UTC (rev 25805)
+++ trunk/src/wp-admin/includes/class-wp-upgrader-skins.php 2013-10-16 04:14:29 UTC (rev 25806)
</span><span class="lines">@@ -529,6 +529,58 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * 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();
+ }
+}
+
+/**
</ins><span class="cx"> * Upgrader Skin for Automatic WordPress Upgrades
</span><span class="cx"> *
</span><span class="cx"> * This skin is designed to be used when no output is intended, all output
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpupgraderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-upgrader.php (25805 => 25806)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-upgrader.php 2013-10-16 04:01:12 UTC (rev 25805)
+++ trunk/src/wp-admin/includes/class-wp-upgrader.php 2013-10-16 04:14:29 UTC (rev 25806)
</span><span class="lines">@@ -307,14 +307,18 @@
</span><span class="cx"> $options = wp_parse_args($options, $defaults);
</span><span class="cx"> extract($options);
</span><span class="cx">
</span><del>- //Connect to the Filesystem first.
</del><ins>+ if ( ! $is_multi ) // call $this->header separately if running multiple times
+ $this->skin->header();
+
+ // Connect to the Filesystem first.
</ins><span class="cx"> $res = $this->fs_connect( array(WP_CONTENT_DIR, $destination) );
</span><del>- if ( ! $res ) //Mainly for non-connected filesystem.
</del><ins>+ // Mainly for non-connected filesystem.
+ if ( ! $res ) {
+ if ( ! $is_multi )
+ $this->skin->footer();
</ins><span class="cx"> return false;
</span><ins>+ }
</ins><span class="cx">
</span><del>- if ( ! $is_multi ) // call $this->header separately if running multiple times
- $this->skin->header();
-
</del><span class="cx"> $this->skin->before();
</span><span class="cx">
</span><span class="cx"> if ( is_wp_error($res) ) {
</span><span class="lines">@@ -368,8 +372,10 @@
</span><span class="cx">
</span><span class="cx"> $this->skin->after();
</span><span class="cx">
</span><del>- if ( ! $is_multi )
</del><ins>+ if ( ! $is_multi ) {
+ do_action( 'upgrader_process_complete', $this, $hook_extra );
</ins><span class="cx"> $this->skin->footer();
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> return $result;
</span><span class="cx"> }
</span><span class="lines">@@ -442,7 +448,10 @@
</span><span class="cx"> 'destination' => WP_PLUGIN_DIR,
</span><span class="cx"> 'clear_destination' => false, // Do not overwrite files.
</span><span class="cx"> 'clear_working' => true,
</span><del>- 'hook_extra' => array()
</del><ins>+ 'hook_extra' => array(
+ 'type' => 'plugin',
+ 'action' => 'install',
+ )
</ins><span class="cx"> ) );
</span><span class="cx">
</span><span class="cx"> remove_filter('upgrader_source_selection', array($this, 'check_package') );
</span><span class="lines">@@ -453,8 +462,6 @@
</span><span class="cx"> // Force refresh of plugin update information
</span><span class="cx"> wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
</span><span class="cx">
</span><del>- do_action( 'upgrader_process_complete', $this, array( 'action' => 'install', 'type' => 'plugin' ), $package );
-
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -490,7 +497,9 @@
</span><span class="cx"> 'clear_destination' => true,
</span><span class="cx"> 'clear_working' => true,
</span><span class="cx"> 'hook_extra' => array(
</span><del>- 'plugin' => $plugin
</del><ins>+ 'plugin' => $plugin,
+ 'type' => 'plugin',
+ 'action' => 'update',
</ins><span class="cx"> ),
</span><span class="cx"> ) );
</span><span class="cx">
</span><span class="lines">@@ -504,8 +513,6 @@
</span><span class="cx"> // Force refresh of plugin update information
</span><span class="cx"> wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
</span><span class="cx">
</span><del>- do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin' ), $plugin );
-
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -587,6 +594,13 @@
</span><span class="cx">
</span><span class="cx"> $this->maintenance_mode(false);
</span><span class="cx">
</span><ins>+ do_action( 'upgrader_process_complete', $this, array(
+ 'action' => 'update',
+ 'type' => 'plugin',
+ 'bulk' => true,
+ 'plugins' => $plugins,
+ ) );
+
</ins><span class="cx"> $this->skin->bulk_footer();
</span><span class="cx">
</span><span class="cx"> $this->skin->footer();
</span><span class="lines">@@ -597,8 +611,6 @@
</span><span class="cx"> // Force refresh of plugin update information
</span><span class="cx"> wp_clean_plugins_cache( $parsed_args['clear_update_cache'] );
</span><span class="cx">
</span><del>- do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'plugin', 'bulk' => true ), $plugins );
-
</del><span class="cx"> return $results;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -814,7 +826,11 @@
</span><span class="cx"> 'package' => $package,
</span><span class="cx"> 'destination' => get_theme_root(),
</span><span class="cx"> 'clear_destination' => false, //Do not overwrite files.
</span><del>- 'clear_working' => true
</del><ins>+ 'clear_working' => true,
+ 'hook_extra' => array(
+ 'type' => 'theme',
+ 'action' => 'install',
+ ),
</ins><span class="cx"> ) );
</span><span class="cx">
</span><span class="cx"> remove_filter('upgrader_source_selection', array($this, 'check_package') );
</span><span class="lines">@@ -826,8 +842,6 @@
</span><span class="cx"> // Refresh the Theme Update information
</span><span class="cx"> wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
</span><span class="cx">
</span><del>- do_action( 'upgrader_process_complete', $this, array( 'action' => 'install', 'type' => 'theme' ), $package );
-
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -863,7 +877,9 @@
</span><span class="cx"> 'clear_destination' => true,
</span><span class="cx"> 'clear_working' => true,
</span><span class="cx"> 'hook_extra' => array(
</span><del>- 'theme' => $theme
</del><ins>+ 'theme' => $theme,
+ 'type' => 'theme',
+ 'action' => 'update',
</ins><span class="cx"> ),
</span><span class="cx"> ) );
</span><span class="cx">
</span><span class="lines">@@ -876,8 +892,6 @@
</span><span class="cx">
</span><span class="cx"> wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
</span><span class="cx">
</span><del>- do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme' ), $theme );
-
</del><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -959,6 +973,13 @@
</span><span class="cx">
</span><span class="cx"> $this->maintenance_mode(false);
</span><span class="cx">
</span><ins>+ do_action( 'upgrader_process_complete', $this, array(
+ 'action' => 'update',
+ 'type' => 'plugin',
+ 'bulk' => true,
+ 'themes' => $themes,
+ ) );
+
</ins><span class="cx"> $this->skin->bulk_footer();
</span><span class="cx">
</span><span class="cx"> $this->skin->footer();
</span><span class="lines">@@ -971,8 +992,6 @@
</span><span class="cx"> // Refresh the Theme Update information
</span><span class="cx"> wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
</span><span class="cx">
</span><del>- do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'theme', 'bulk' => true ), $themes );
-
</del><span class="cx"> return $results;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1073,18 +1092,27 @@
</span><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>-add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20, 3 );
</del><ins>+add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
</ins><span class="cx"> class Language_Pack_Upgrader extends WP_Upgrader {
</span><span class="cx">
</span><span class="cx"> var $result;
</span><span class="cx"> var $bulk = true;
</span><span class="cx">
</span><del>- static function async_upgrade( $upgrader, $context, $package ) {
</del><ins>+ static function async_upgrade( $upgrader = false ) {
</ins><span class="cx"> // Avoid recursion.
</span><del>- if ( $upgrader instanceof Language_Pack_Upgrader )
</del><ins>+ if ( $upgrader && $upgrader instanceof Language_Pack_Upgrader )
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- $lp_upgrader = new Language_Pack_Upgrader( new Headerless_Upgrader_Skin() );
</del><ins>+ // 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 );
</ins><span class="cx"> $lp_upgrader->upgrade();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1098,24 +1126,37 @@
</span><span class="cx"> $this->strings['process_success'] = __( 'Translation updated successfully.' );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- function upgrade( $update = false ) {
</del><ins>+ function upgrade( $update = false, $args = array() ) {
</ins><span class="cx"> if ( $update )
</span><span class="cx"> $update = array( $update );
</span><del>- $results = $this->bulk_upgrade( $update );
</del><ins>+ $results = $this->bulk_upgrade( $update, $args );
</ins><span class="cx"> return $results[0];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- function bulk_upgrade( $language_updates = array() ) {
</del><ins>+ function bulk_upgrade( $language_updates = array(), $args = array() ) {
</ins><span class="cx"> global $wp_filesystem;
</span><span class="cx">
</span><ins>+ $defaults = array(
+ 'clear_update_cache' => true,
+ );
+ $parsed_args = wp_parse_args( $args, $defaults );
+
</ins><span class="cx"> $this->init();
</span><span class="cx"> $this->upgrade_strings();
</span><span class="cx">
</span><span class="cx"> if ( ! $language_updates )
</span><span class="cx"> $language_updates = wp_get_translation_updates();
</span><span class="cx">
</span><del>- if ( empty( $language_updates ) )
</del><ins>+ 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();
</ins><span class="cx"> return true;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> if ( 'upgrader_process_complete' == current_filter() )
</span><span class="cx"> $this->skin->feedback( 'starting_upgrade' );
</span><span class="lines">@@ -1145,6 +1186,8 @@
</span><span class="cx">
</span><span class="cx"> foreach ( $language_updates as $language_update ) {
</span><span class="cx">
</span><ins>+ $this->skin->language_update = $language_update;
+
</ins><span class="cx"> $destination = WP_LANG_DIR;
</span><span class="cx"> if ( 'plugin' == $language_update->type )
</span><span class="cx"> $destination .= '/plugins';
</span><span class="lines">@@ -1175,9 +1218,19 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ $this->skin->bulk_footer();
+
+ $this->skin->footer();
+
</ins><span class="cx"> // Clean up our hooks, in case something else does an upgrade on this connection.
</span><span class="cx"> remove_filter( 'upgrader_source_selection', array( &$this, 'check_package' ), 10, 2 );
</span><span class="cx">
</span><ins>+ if ( $parsed_args['clear_update_cache'] ) {
+ wp_clean_themes_cache( true );
+ wp_clean_plugins_cache( true );
+ delete_site_transient( 'update_core' );
+ }
+
</ins><span class="cx"> return $results;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1206,6 +1259,26 @@
</span><span class="cx"> return $source;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ 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 '';
+ }
+
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -1321,7 +1394,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ), $result );
</del><span class="cx"> return $result;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1628,42 +1700,8 @@
</span><span class="cx"> $skin->feedback( __( 'Updating plugin: %s' ), $item_name );
</span><span class="cx"> break;
</span><span class="cx"> case 'language':
</span><del>- if ( 'theme' == $item->type ) {
- $theme = wp_get_theme( $item->slug );
- $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
- );
- }
-
</del><ins>+ $name = $upgrader->get_name_for_update( $item );
+ $skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)…' ), $name, $item->language ) );
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1711,7 +1749,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // Don't automatically run these thins, as we'll handle it ourselves
</span><del>- remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20, 3 );
</del><ins>+ remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
</ins><span class="cx"> remove_action( 'upgrader_process_complete', 'wp_version_check' );
</span><span class="cx"> remove_action( 'upgrader_process_complete', 'wp_update_plugins' );
</span><span class="cx"> remove_action( 'upgrader_process_complete', 'wp_update_themes' );
</span></span></pre></div>
<a id="trunksrcwpadminincludesfilephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/file.php (25805 => 25806)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/file.php 2013-10-16 04:01:12 UTC (rev 25805)
+++ trunk/src/wp-admin/includes/file.php 2013-10-16 04:14:29 UTC (rev 25806)
</span><span class="lines">@@ -891,6 +891,11 @@
</span><span class="cx"> if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
</span><span class="cx"> if ( !$context )
</span><span class="cx"> $context = WP_CONTENT_DIR;
</span><ins>+
+ // 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 );
+
</ins><span class="cx"> $context = trailingslashit($context);
</span><span class="cx"> $temp_file_name = $context . 'temp-write-test-' . time();
</span><span class="cx"> $temp_handle = @fopen($temp_file_name, 'w');
</span><span class="lines">@@ -1021,9 +1026,8 @@
</span><span class="cx"> -->
</span><span class="cx"> </script>
</span><span class="cx"> <form action="<?php echo esc_url( $form_post ) ?>" method="post">
</span><del>-<div class="wrap">
-<?php screen_icon(); ?>
-<h2><?php _e('Connection Information') ?></h2>
</del><ins>+<div>
+<h3><?php _e('Connection Information') ?></h3>
</ins><span class="cx"> <p><?php
</span><span class="cx"> $label_user = __('Username');
</span><span class="cx"> $label_pass = __('Password');
</span></span></pre></div>
<a id="trunksrcwpadminincludesupdatecorephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/update-core.php (25805 => 25806)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/update-core.php 2013-10-16 04:01:12 UTC (rev 25805)
+++ trunk/src/wp-admin/includes/update-core.php 2013-10-16 04:14:29 UTC (rev 25806)
</span><span class="lines">@@ -889,6 +889,9 @@
</span><span class="cx"> // Remove maintenance file, we're done.
</span><span class="cx"> $wp_filesystem->delete($maintenance_file);
</span><span class="cx">
</span><ins>+ // 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' ) );
+
</ins><span class="cx"> // If we made it this far:
</span><span class="cx"> do_action( '_core_updated_successfully', $wp_version );
</span><span class="cx">
</span></span></pre></div>
<a id="trunksrcwpadminupdatecorephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/update-core.php (25805 => 25806)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/update-core.php 2013-10-16 04:01:12 UTC (rev 25805)
+++ trunk/src/wp-admin/update-core.php 2013-10-16 04:14:29 UTC (rev 25806)
</span><span class="lines">@@ -324,6 +324,27 @@
</span><span class="cx"> <?php
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+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
+}
+
</ins><span class="cx"> /**
</span><span class="cx"> * Upgrade WordPress core display.
</span><span class="cx"> *
</span><span class="lines">@@ -341,8 +362,6 @@
</span><span class="cx"> else
</span><span class="cx"> $url = 'update-core.php?action=do-core-upgrade';
</span><span class="cx"> $url = wp_nonce_url($url, 'upgrade-core');
</span><del>- if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) )
- return;
</del><span class="cx">
</span><span class="cx"> $version = isset( $_POST['version'] )? $_POST['version'] : false;
</span><span class="cx"> $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
</span><span class="lines">@@ -350,15 +369,24 @@
</span><span class="cx"> if ( !$update )
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if ( ! WP_Filesystem($credentials, ABSPATH) ) {
- request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again
- return;
- }
</del><span class="cx"> ?>
</span><span class="cx"> <div class="wrap">
</span><span class="cx"> <?php screen_icon('tools'); ?>
</span><span class="cx"> <h2><?php _e('Update WordPress'); ?></h2>
</span><span class="cx"> <?php
</span><ins>+
+ 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;
+ }
+
</ins><span class="cx"> if ( $wp_filesystem->errors->get_error_code() ) {
</span><span class="cx"> foreach ( $wp_filesystem->errors->get_error_messages() as $message )
</span><span class="cx"> show_message($message);
</span><span class="lines">@@ -477,12 +505,15 @@
</span><span class="cx"> echo ' <a class="button" href="' . esc_url( self_admin_url('update-core.php') ) . '">' . __( 'Check Again' ) . '</a>';
</span><span class="cx"> echo '</p>';
</span><span class="cx">
</span><del>- if ( current_user_can( 'update_core' ) )
</del><ins>+ if ( $core = current_user_can( 'update_core' ) )
</ins><span class="cx"> core_upgrade_preamble();
</span><del>- if ( current_user_can( 'update_plugins' ) )
</del><ins>+ if ( $plugins = current_user_can( 'update_plugins' ) )
</ins><span class="cx"> list_plugin_updates();
</span><del>- if ( current_user_can( 'update_themes' ) )
</del><ins>+ if ( $themes = current_user_can( 'update_themes' ) )
</ins><span class="cx"> list_theme_updates();
</span><ins>+ if ( $core || $plugins || $themes )
+ list_translation_updates();
+ unset( $core, $plugins, $themes );
</ins><span class="cx"> do_action('core_upgrade_preamble');
</span><span class="cx"> echo '</div>';
</span><span class="cx"> include(ABSPATH . 'wp-admin/admin-footer.php');
</span><span class="lines">@@ -570,6 +601,26 @@
</span><span class="cx"> echo '</div>';
</span><span class="cx"> include(ABSPATH . 'wp-admin/admin-footer.php');
</span><span class="cx">
</span><ins>+} 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' );
+
</ins><span class="cx"> } else {
</span><span class="cx"> do_action('update-core-custom_' . $action);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>