Skip to content

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sawanoboly committed Mar 16, 2021
1 parent 8fb35e0 commit f96b884
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
wp-serverless-api.tgz
wp-serverless-api.zip
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: archive clean

archive: clean
zip -r wp-serverless-api.zip *.php *.md

clean:
rm -f wp-serverless-api.zip
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ Explore WordPress data via the WP REST API as a JSON file for static WordPress H
1. Install as a WordPress Plugin
2. Activate and save or create a new post or page
3. Create a new static Artifact on Shifter
4. Visit your new WP Serverless API endpoint at `example.com/wp-content/uploads/wp-sls-api/db.json`
4. Visit your new WP Serverless API endpoint at `example.com/wp-content/wp-sls-api/db.json`

## CHANGELOG

### 0.2.0

- [BREAKING CHANGE] Change save path from `/wp-content/uploads/wp-sls-api/db.json` to `/wp-content/wp-sls-api/db.json`
13 changes: 7 additions & 6 deletions wp-serverless-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

/*
Plugin Name: WP Serverless API
Author: Daniel Olson
Author URI: https://github.com/emaildano/wp-serverless-api
Plugin URI: https://github.com/getshifter/wp-serverless-api
Description: WordPress REST API to JSON File
Version: 0.2.0
Author: Shifter
Author URI: https://getshifter.io
*/

function enable_permalinks_notice() {
Expand Down Expand Up @@ -51,10 +53,9 @@ function save_db(
$db,
$file_name = 'db.json'
) {
$upload_dir = wp_get_upload_dir();
$save_path = $upload_dir['basedir'] . '/wp-sls-api/' . $file_name;
$save_path = WP_CONTENT_DIR . '/wp-sls-api/' . $file_name;
$dirname = dirname($save_path);

if (!is_dir($dirname))
{
mkdir($dirname, 0755, true);
Expand All @@ -74,4 +75,4 @@ function build_db()
/**
* Build on Post Save
*/
add_action( 'save_post', 'build_db' );
add_action( 'save_post', 'build_db' );

0 comments on commit f96b884

Please sign in to comment.