diff --git a/README.md b/README.md index ada78d004..009e94481 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Feel free to test out the extension using this [GraphiQL Playground](https://woo (*) I have a tendency to forget to update the playground between releases :sweat_smile:, so if you believe this to be the case look me up somewhere on this page and lemme know :man_shrugging: -## Wanna help support WooGraphQL's future. +## Wanna help support WooGraphQL's future - Sponsor **@kidunot89** *(WooGraphQL Creator/Developer)* on **[Github](https://github.com/sponsors/kidunot89)** - Sponsor **WooGraphQL** on **[OpenCollective](https://opencollective.com/woographql)** diff --git a/README.txt b/README.txt index 53d10abde..fea05d3a8 100644 --- a/README.txt +++ b/README.txt @@ -7,7 +7,7 @@ Requires PHP: 7.1 Requires WooCommerce: 4.8.0 Requires WPGraphQL: 1.3.9+ Works with WPGraphQL-JWT-Authentication: 0.4.0+ -Stable tag: 0.10.0 +Stable tag: 0.10.1 License: GPL-3 License URI: https://www.gnu.org/licenses/gpl-3.0.html Maintained at: https://github.com/wp-graphql/wp-graphql-woocommerce diff --git a/access-functions.php b/access-functions.php index c31a716a0..200864e92 100644 --- a/access-functions.php +++ b/access-functions.php @@ -4,6 +4,9 @@ * * @package WPGraphQL\WooCommerce * @since 0.0.1 + * @deprecated v0.10.2 + * + * Will be removed in v0.11.0. Some functions will be relocated. */ /** diff --git a/class-woographql-inflect.php b/class-woographql-inflect.php index 8bafbf436..20ced6f43 100644 --- a/class-woographql-inflect.php +++ b/class-woographql-inflect.php @@ -9,6 +9,9 @@ * @link https://gist.github.com/tbrianjones/ba0460cc1d55f357e00b * @package WPGraphQL\WooCommerce * @since 0.0.4 + * @deprecated v0.10.2 + * + * Will be removed in v0.11.0. Functionality will be no longer in use. */ if ( ! class_exists( 'WooGraphQL_Inflect' ) ) : diff --git a/composer.lock b/composer.lock index c84309307..afd28272f 100644 --- a/composer.lock +++ b/composer.lock @@ -182,5 +182,5 @@ "php": ">=7.1.0" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.0.0" } diff --git a/includes/class-wp-graphql-woocommerce.php b/includes/class-wp-graphql-woocommerce.php index ea428f948..0590875d2 100644 --- a/includes/class-wp-graphql-woocommerce.php +++ b/includes/class-wp-graphql-woocommerce.php @@ -137,14 +137,56 @@ public function __wakeup() { */ private function includes() { - // Autoload Required Classes. - if ( defined( 'WPGRAPHQL_WOOCOMMERCE_AUTOLOAD' ) && false !== WPGRAPHQL_WOOCOMMERCE_AUTOLOAD ) { - require_once WPGRAPHQL_WOOCOMMERCE_PLUGIN_DIR . 'vendor/autoload.php'; + /** + * WPGRAPHQL_AUTOLOAD can be set to "false" to prevent the autoloader from running. + * In most cases, this is not something that should be disabled, but some environments + * may bootstrap their dependencies in a global autoloader that will autoload files + * before we get to this point, and requiring the autoloader again can trigger fatal errors. + * + * The codeception tests are an example of an environment where adding the autoloader again causes issues + * so this is set to false for tests. + */ + if ( defined( 'WPGRAPHQL_WOOCOMMERCE_AUTOLOAD' ) && true === WPGRAPHQL_WOOCOMMERCE_AUTOLOAD ) { + if ( file_exists( WPGRAPHQL_WOOCOMMERCE_PLUGIN_DIR . 'vendor/autoload.php' ) ) { + // Autoload Required Classes. + require_once WPGRAPHQL_WOOCOMMERCE_PLUGIN_DIR . 'vendor/autoload.php'; + } + + /** + * If GraphQL class doesn't exist, then dependencies cannot be + * detected. This likely means the user cloned the repo from Github + * but did not run `composer install` + */ + if ( ! class_exists( 'Firebase\JWT\JWT' ) ) { + add_action( + 'admin_notices', + function () { + if ( ! current_user_can( 'manage_options' ) ) { + return; + } + + echo sprintf( + '
%s
' . + '