Skip to content

Commit

Permalink
- fix patch for wpengine users
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbahl committed Oct 18, 2022
1 parent 728e057 commit 1fa3f57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
8 changes: 8 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ In order to use v0.2.0+ of WPGraphQL Smart Cache, you will need WPGraphQL v1.12.

== Changelog ==

= 0.2.2 =

- fix bug with patch. Missing namespace

= 0.2.1 =

- add patch for wp-engine customers. will be removed when the wp-engine mu plugin is updated

= 0.2.0

- chore: remove unreferenced .zip build artifact
Expand Down
14 changes: 12 additions & 2 deletions wp-graphql-smart-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Requires PHP: 7.4
* Text Domain: wp-graphql-smart-cache
* Domain Path: /languages
* Version: 0.2.0
* Version: 0.2.2
* License: GPL-3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
Expand All @@ -35,7 +35,7 @@
}

const WPGRAPHQL_REQUIRED_MIN_VERSION = '1.2.0';
const WPGRAPHQL_SMART_CACHE_VERSION = '0.2.0';
const WPGRAPHQL_SMART_CACHE_VERSION = '0.2.2';

require __DIR__ . '/vendor/autoload.php';

Expand Down Expand Up @@ -188,3 +188,13 @@ function () {
$invalidation->init();
}
);

add_action( 'graphql_purge', function( $purge_keys ) {
if ( ! function_exists( 'graphql_get_endpoint_url' ) || ! method_exists( 'WpeCommon', 'http_to_varnish' ) ) {
return;
}
\WpeCommon::http_to_varnish( 'PURGE_GRAPHQL', null, [
'GraphQL-Purge-Keys' => $purge_keys,
'GraphQL-URL' => graphql_get_endpoint_url(),
] );
}, 0, 1 );

0 comments on commit 1fa3f57

Please sign in to comment.