Upgrader: Use always `window.postMessage` for decrement of update count bubbles when `IFRAME_REQUEST` is defined.
Fixes decrement of translation update count bubbles when updated through the bulk upgrader. fixes #29054. Built from https://develop.svn.wordpress.org/trunk@29357 git-svn-id: http://core.svn.wordpress.org/trunk@29133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
608d505b24
commit
cd58a064cf
|
@ -104,13 +104,22 @@ class WP_Upgrader_Skin {
|
|||
if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) {
|
||||
return;
|
||||
}
|
||||
echo '<script type="text/javascript">
|
||||
(function( wp ) {
|
||||
if ( wp && wp.updates.decrementCount ) {
|
||||
wp.updates.decrementCount( "' . $type . '" );
|
||||
|
||||
if ( defined( 'IFRAME_REQUEST' ) ) {
|
||||
echo '<script type="text/javascript">
|
||||
if ( window.postMessage && JSON ) {
|
||||
window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname );
|
||||
}
|
||||
})( window.wp );
|
||||
</script>';
|
||||
</script>';
|
||||
} else {
|
||||
echo '<script type="text/javascript">
|
||||
(function( wp ) {
|
||||
if ( wp && wp.updates.decrementCount ) {
|
||||
wp.updates.decrementCount( "' . $type . '" );
|
||||
}
|
||||
})( window.wp );
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,25 +293,6 @@ class Bulk_Upgrader_Skin extends WP_Upgrader_Skin {
|
|||
wp_ob_end_flush_all();
|
||||
flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Output JavaScript that sends message to parent window to decrement the update counts.
|
||||
*
|
||||
* @since 3.9.0
|
||||
*
|
||||
* @param string $type Type of update count to decrement. Likely values include 'plugin',
|
||||
* 'theme', 'translation', etc.
|
||||
*/
|
||||
protected function decrement_update_count( $type ) {
|
||||
if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) {
|
||||
return;
|
||||
}
|
||||
echo '<script type="text/javascript">
|
||||
if ( window.postMessage && JSON ) {
|
||||
window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname );
|
||||
}
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
|
||||
class Bulk_Plugin_Upgrader_Skin extends Bulk_Upgrader_Skin {
|
||||
|
|
Loading…
Reference in New Issue