Skip to content

Commit

Permalink
Guard against non-existent site transients.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmymadon committed Oct 18, 2023
1 parent ccf20bd commit f8f33aa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion includes/Core/Util/Auto_Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,17 @@ protected static function get_sitekit_update_data() {
);

$plugin_updates = get_site_transient( 'update_plugins' );
$transient_data = isset( $plugin_updates->response[ GOOGLESITEKIT_PLUGIN_BASENAME ] ) ? $plugin_updates->response[ GOOGLESITEKIT_PLUGIN_BASENAME ] : $plugin_updates->no_update[ GOOGLESITEKIT_PLUGIN_BASENAME ];

$transient_data = array();

if ( isset( $plugin_updates->noupdate[ GOOGLESITEKIT_PLUGIN_BASENAME ] ) ) {
$transient_data = $plugin_updates->noupdate[ GOOGLESITEKIT_PLUGIN_BASENAME ];
}

if ( isset( $plugin_updates->response[ GOOGLESITEKIT_PLUGIN_BASENAME ] ) ) {
$transient_data = $plugin_updates->response[ GOOGLESITEKIT_PLUGIN_BASENAME ];
}

return array_merge( $sitekit_update_data, (array) $transient_data );
}

Expand Down

0 comments on commit f8f33aa

Please sign in to comment.