From 46a2588f8e09d716255224db2816d37aa4099e11 Mon Sep 17 00:00:00 2001 From: Thomas Heyenbrock Date: Thu, 7 Mar 2024 11:16:31 +0100 Subject: [PATCH] bump version to 0.1.7 --- DEVELOPMENT.md | 14 +++++++------- readme.txt | 2 +- wp-stellate.php | 38 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index ef3b94e..99bd94d 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -7,7 +7,7 @@ in an actual WordPress site where you can play around with it! > **Note** > You don't need to create an account to be able to create a new local Wordpress instance -Once you have a WordPress website running, click "Go to site folder" to open your installation in Finder. +Once you have a WordPress website running, click "Go to site folder" to open your installation in Finder. You can drag & drop this folder into your shell of choice to get the path pasted. Then navigate to the actual WordPress installation in `app/public` ```sh @@ -25,7 +25,7 @@ WordPress site is located: ln -s /path/to/this/repo/wp-stellate ./wp-content/plugins/wp-stellate ``` -Next, open up the WP Admin panel and log in with the credentials you entered during WordPress installation. +Next, open up the WP Admin panel and log in with the credentials you entered during WordPress installation. On the left, navigate to "Plugins" and add a new one. Search for "GraphQL" and install the "WPGraphQL" plugin and activate it. Now you should see in the left navigation a "GraphQL" section that contains a sub-item called "Caching". In there, configure the service name and purging token to use. @@ -70,10 +70,10 @@ rm -rf my-folder/trunk/* cp /path/to/wp-stellate/* my-folder/trunk ``` -Before moving on, make sure that the stable version in the `readme.txt` file +Before moving on, make sure that the stable version in the `readme.txt` file is set to the version you're about to create. -Move into the folder that contains the SVN repository and add all the files +Move into the folder that contains the SVN repository and add all the files you just changed: ```sh @@ -87,7 +87,7 @@ svn add trunk/* > There is no "staging area" like in git and all changes to existing files will be synced in the command below by copying to a new tag. To create the new tag, copy the trunk into a new folder in `tags`. We -strive to use semantic versioning, so replace `x`, `y`, and `z` with +strive to use semantic versioning, so replace `x`, `y`, and `z` with the approproate numbers. ```sh @@ -95,8 +95,8 @@ svn copy trunk tags/x.y.z ``` Now you can commit the changes. This will also push the commit to the remote -SVN repository, so you need to authorize. Pass the username `stellatehq` via -the `--username` flag and enter the password when promted. You can find these +SVN repository, so you need to authorize. Pass the username `stellatehq` via +the `--username` flag and enter the password when promted. You can find these credentials in our shared 1Password. ```sh diff --git a/readme.txt b/readme.txt index dac11c6..129350c 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Tags: Stellate, GraphQL, WPGraphQL, API, Caching, Edge, Performance Requires at least: 5.0 Tested up to: 6.4.0 Requires PHP: 7.1 -Stable tag: 0.1.6 +Stable tag: 0.1.7 License: GPL-3 License URI: https://www.gnu.org/licenses/gpl-3.0.html diff --git a/wp-stellate.php b/wp-stellate.php index e422695..b1fc58d 100644 --- a/wp-stellate.php +++ b/wp-stellate.php @@ -7,7 +7,7 @@ * Description: Stellate for your WordPress GraphQL API * Author: Stellate * Author URI: https://stellate.co - * Version: 0.1.6 + * Version: 0.1.7 * Requires at least: 5.0 * Tested up to: 6.4.0 * Requires PHP: 7.1 @@ -16,7 +16,7 @@ * * @package Stellate * @author Stellate - * @version 0.1.6 + * @version 0.1.7 */ /** @@ -28,6 +28,25 @@ } +/** + * TEMP: Add custom post type + */ +add_action( 'init', function() { + register_post_type( 'product', [ + 'show_ui' => true, # whether you want the post_type to show in the WP Admin UI. Doesn't affect WPGraphQL Schema. + 'labels' => [ + //@see https://developer.wordpress.org/themes/functionality/internationalization/ + 'menu_name' => __( 'Products', 'your-textdomain' ), # The label for the WP Admin. Doesn't affect the WPGraphQL Schema. + ], + 'hierarchical' => true, # set to false if you don't want parent/child relationships for the entries + 'show_in_graphql' => true, # Set to false if you want to exclude this type from the GraphQL Schema + 'graphql_single_name' => 'product', + 'graphql_plural_name' => 'products', # If set to the same name as graphql_single_name, the field name will default to `all${graphql_single_name}`, i.e. `allDocument`. + 'public' => true, # set to false if entries of the post_type should not have public URIs per entry + 'publicly_queryable' => true, # Set to false if entries should only be queryable in WPGraphQL by authenticated requests + ] ); +} ); + /** * Register the settings @@ -503,6 +522,9 @@ function stellate_purge_all() */ function stellate_call_admin_api($query, $variables) { + stellate_log($query); + stellate_log($variables); + $service_name = get_option('stellate_service_name'); $token = get_option('stellate_purging_token'); @@ -541,3 +563,15 @@ function stellate_call_admin_api($query, $variables) return null; } + +function stellate_log( $msg, $name = '' ) +{ + // Print the name of the calling function if $name is left empty + $trace=debug_backtrace(); + $name = ( '' == $name ) ? $trace[1]['function'] : $name; + + $error_dir = '/Users/thomasheyenbrock/Local Sites/wpstellatedev/app/public/wp-content/stellate-plugin.log'; + $msg = print_r( $msg, true ); + $log = $name . " | " . $msg . "\n"; + error_log( $log, 3, $error_dir ); +}