Skip to content

Commit

Permalink
Fix updater slug mismatch (#195)
Browse files Browse the repository at this point in the history
* fix: hardcode slug value since wp-product-info does not match.

* Add changeset
  • Loading branch information
mindctrl authored Feb 28, 2024
1 parent 0ab01f1 commit 1117a18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-bats-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wpengine/wp-graphql-content-blocks": patch
---

Fixed issue with updater functionality.
3 changes: 2 additions & 1 deletion includes/updates/update-callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function check_for_plugin_updates( $data ) {
return $data;
}

$response->slug = 'wp-graphql-content-blocks';
$current_plugin_data = \get_plugin_data( WPGRAPHQL_CONTENT_BLOCKS_FILE );
$meets_wp_req = version_compare( get_bloginfo( 'version' ), $response->requires_at_least, '>=' );

Expand Down Expand Up @@ -114,7 +115,7 @@ function display_plugin_row_notice() {
$error = get_plugin_api_error();

?>
<tr class="plugin-update-tr active" id="wpgraphql-content-blocks-update" data-slug="wpgraphql-content-blocks" data-plugin="wpgraphql-content-blocks/wpgraphql-content-blocks.php">
<tr class="plugin-update-tr active" id="wp-graphql-content-blocks-update" data-slug="wp-graphql-content-blocks" data-plugin="wp-graphql-content-blocks/wp-graphql-content-blocks.php">
<td colspan="4" class="plugin-update">
<div class="update-message notice inline notice-error notice-alt">
<p>
Expand Down
2 changes: 1 addition & 1 deletion includes/updates/update-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function get_plugin_data_from_wpe( $args ) {
$api->name = $product_info->name;
$api->requires = isset( $product_info->requires_at_least ) ? $product_info->requires_at_least : $current_plugin_data['RequiresWP'];
$api->sections['changelog'] = isset( $product_info->sections->changelog ) ? $product_info->sections->changelog : '<h4>1.0</h4><ul><li>Initial release.</li></ul>';
$api->slug = $args->slug;
$api->slug = 'wp-graphql-content-blocks';

// Only pass along the update info if the requirements are met and there's actually a newer version.
if ( $meets_wp_req && version_compare( $current_plugin_data['Version'], $product_info->version, '<' ) ) {
Expand Down

0 comments on commit 1117a18

Please sign in to comment.