Skip to content

Commit

Permalink
Merge pull request #7 from zngly/fix/6/zip
Browse files Browse the repository at this point in the history
Fix/6/zip
  • Loading branch information
zngly-vlad authored Aug 8, 2022
2 parents 454d36b + ff76a65 commit eaa384e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Wordpress plugin which add mutations to ACF Fields

### Install

https://packagist.org/packages/zngly/wp-graphql-acf-mutations
<https://packagist.org/packages/zngly/wp-graphql-acf-mutations>

`composer require zngly/wp-graphql-acf-mutations`

Expand All @@ -27,6 +27,14 @@ If an acf type needs a specific graphql type such as a custom enum then specify

Currently the mutations will not be set for objects nested with more than one child deep.

### Zip Install

1. Download the [Latest Release](https://github.com/zngly/wp-graphql-acf-mutations/releases)
2. Extract the contents of the zip file into a folder `wp-graphql-acf-mutations`
3. Place the `wp-graphql-acf-mutations` folder in your `wp-content/plugins` folder
4. From `wp-content/plugins/wp-graphql-acf-mutations` directory run `composer install:prod`
5. Activate the plugin

### Dev Usage

- clone the repository
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.1.1",
"name": "zngly/wp-graphql-acf-mutations",
"description": "ACF Mutations for WP GraphQL",
"homepage": "https://github.com/zngly/wp-graphql-acf-mutations",
Expand Down Expand Up @@ -80,7 +80,7 @@
]
},
"scripts": {
"install": "composer install --no-dev",
"install:prod": "composer install --no-dev",
"install:dev": [
"Zngly\\ACFM\\Scripts\\Install::run"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wp-graphql-acf-mutations",
"version": "1.1.0",
"version": "1.1.1",
"description": "wp-graphql-acf-mutations",
"homepage": "https://github.com/zngly/wp-graphql-acf-mutations#readme",
"author": "Vlad-Anton Medves",
Expand Down
6 changes: 3 additions & 3 deletions scripts/Watcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public static function run()
// get the directory to watch
$src_folder = Utils::get_root_dir() . '/src';

// get all the files in the directory recursively
// get all the path to the main plugin file
$plugin_name = Utils::get_plugin_name();
$plugin_folder = Utils::get_root_dir() . "/wordpress/wp-content/plugins/{$plugin_name}";
$main_plugin_file = Utils::get_root_dir() . "/{$plugin_name}.php";

// watch for any file changes in the directory
self::watch_dirs([$src_folder, "{$plugin_folder}/{$plugin_name}.php"]);
self::watch_dirs([$src_folder, $main_plugin_file]);
}

// function to watch a directory for changes
Expand Down
24 changes: 23 additions & 1 deletion wp-graphql-acf-mutations.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Adds Advanced Custom Fields Mutations to the WPGraphQL Schema
* Author: Vlad-Anton Medves
* Text Domain: wp-graphql-acf
* Version: 1.0.5
* Version: v1.1.1
* Requires PHP: 7.0
*
* @package WPGraphQL_ACF_Mutations
Expand All @@ -17,6 +17,28 @@
exit;
}

// if namespace Zngly\ACFM is not defined
if (!class_exists('Zngly\\ACFM\\Mutations')) {
// require the autoloader in wordpress/vendor/autoload.php
// if the autoloader is not found, exit with an error message
if (!file_exists(__DIR__ . '/wordpress/vendor/autoload.php')) {
wp_die(
"
<samp>
Error: Could not load WPGraphQL ACF Mutations. Please install the WPGraphQL ACF Mutations plugin via Composer.
</samp>
<br>
<br>
<code>
composer install:prod
</code>
"
);
}

require_once __DIR__ . '/wordpress/vendor/autoload.php';
}

/**
* Define constants
*/
Expand Down

0 comments on commit eaa384e

Please sign in to comment.