diff options
Diffstat (limited to 'plugins/jetpack/sync/class.jetpack-sync-module-updates.php')
-rw-r--r-- | plugins/jetpack/sync/class.jetpack-sync-module-updates.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-updates.php b/plugins/jetpack/sync/class.jetpack-sync-module-updates.php index 2db14ee5..d40be62d 100644 --- a/plugins/jetpack/sync/class.jetpack-sync-module-updates.php +++ b/plugins/jetpack/sync/class.jetpack-sync-module-updates.php @@ -118,7 +118,7 @@ class Jetpack_Sync_Module_Updates extends Jetpack_Sync_Module { $no_updated = array(); switch ( $transient ) { case 'update_plugins': - if ( ! empty( $update->response ) ) { + if ( ! empty( $update->response ) && is_array( $update->response ) ) { foreach ( $update->response as $plugin_slug => $response ) { if ( ! empty( $plugin_slug ) && isset( $response->new_version ) ) { $updates[] = array( $plugin_slug => $response->new_version ); @@ -135,7 +135,7 @@ class Jetpack_Sync_Module_Updates extends Jetpack_Sync_Module { break; case 'update_themes': - if ( ! empty( $update->response ) ) { + if ( ! empty( $update->response ) && is_array( $update->response ) ) { foreach ( $update->response as $theme_slug => $response ) { if ( ! empty( $theme_slug ) && isset( $response['new_version'] ) ) { $updates[] = array( $theme_slug => $response['new_version'] ); @@ -149,7 +149,7 @@ class Jetpack_Sync_Module_Updates extends Jetpack_Sync_Module { break; case 'update_core': - if ( ! empty( $update->updates ) ) { + if ( ! empty( $update->updates ) && is_array( $update->updates ) ) { foreach ( $update->updates as $response ) { if( ! empty( $response->response ) && $response->response === 'latest' ) { continue; @@ -192,6 +192,17 @@ class Jetpack_Sync_Module_Updates extends Jetpack_Sync_Module { $checksums[ $transient ] = $new_checksum; update_option( self::UPDATES_CHECKSUM_OPTION_NAME, $checksums ); + /** + * jetpack_{$transient}_change + * jetpack_update_plugins_change + * jetpack_update_themes_change + * jetpack_update_core_change + * + * @since 5.1.0 + * + * @param array containing info that tells us what needs updating + * + */ do_action( "jetpack_{$transient}_change", $value ); } @@ -254,6 +265,10 @@ class Jetpack_Sync_Module_Updates extends Jetpack_Sync_Module { if ( ! isset( $args[0], $args[0]->response ) ) { return $args; } + if ( ! is_array( $args[0]->response ) ) { + trigger_error( 'Warning: Not an Array as expected but -> ' . wp_json_encode( $args[0]->response ) . ' instead', E_USER_WARNING ); + return $args; + } foreach ( $args[0]->response as $stylesheet => &$theme_data ) { $theme = wp_get_theme( $stylesheet ); $theme_data['name'] = $theme->name; |