Open mkiser opened 7 years ago
The only thing I'll point out off the top is that the semaphore should expire after a minute. If you're reattempting within that timeframe, you may still see it locked (although it shouldn't "relock" or restart the timer). Did you do an initial sync w/ the repo? The errors appear to be from PRs/commits coming in.
Thanks! The initial sync (export or import) always results in a message at the top saying it started, but nothing ever happens.
I did just get this error with the webhook We couldn’t deliver this payload: Service Timeout
when starting over (new webhook, new oauth, new secret).
Here's the log:
[28-Jun-2017 14:43:25 UTC] PHP Notice: Undefined property: stdClass::$ref in /var/www/html/wp-content/plugins/wp-github-sync/lib/payload.php on line 49
[28-Jun-2017 14:43:25 UTC] PHP Notice: Undefined property: stdClass::$head_commit in /var/www/html/wp-content/plugins/wp-github-sync/lib/payload.php on line 85
[28-Jun-2017 14:43:25 UTC] [Missing Commit ID] won't be imported.
[28-Jun-2017 14:44:28 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 31518720 bytes) in /var/www/html/wp-includes/functions.php on line 435
[28-Jun-2017 14:46:26 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 31518720 bytes) in /var/www/html/wp-includes/functions.php on line 435
[28-Jun-2017 14:50:29 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 31518720 bytes) in /var/www/html/wp-includes/functions.php on line 435
[28-Jun-2017 14:54:44 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 31518720 bytes) in /var/www/html/wp-includes/functions.php on line 435
Hmmm, maybe you have a low max memory allocation for PHP. 128MBs is on the low side, and we do hold a lot of information in memory at once, so I wouldn't be surprised if that's what's causing the problem. You would need to modify ur php.ini file to increase the max and see if that fixes it.
K. I bumped to 1G in php.ini and wp-config.php. Tried again and it worked - sort of. Nuked my entire repo (https://github.com/mkiser/WTFJHT/commit/310068d4ee41f3508bef6f4d8a7282ced74d4e6b), but it's a start.
I'm guessing this is due to YAML not being properly formatted in the originals? Lesson learned on fussing with a production repo...
It's not the formatting; none of the original files has the post ID in it, which is what WPGHS uses to match up the file with the post internally. I'm a bit surprised it cleaned out so much other stuff though...
Ah, interesting. So, I have this Jekyll blog that I want to edit in WP's WYSIWYG. I presumed I could just import the _posts folder into WP, edit, save, and have those push back to the repo (which has a Travis hook to rebuild the site on commits to master). I'm unfamiliar with post ID's being assigned by Jekyll. Are those post ID's only assigned from WP to Jekyll? Maybe I don't understand 😞
Are those post ID's only assigned from WP to Jekyll?
Exactly this. I don't think most of what you wrote was deleted, just renamed to match the post slugs in WordPress, plus the post id is added to the YAML. Jekyll does not assign post IDs, those are WP-only, because they are saved in a database, rather than as flat files, in Jekyll.
Got it. Thank you.
My goal is to use WP as a headless CMS for my Jekyll blog to handle user accounts, WYSIWYG editing, and drafts – and that's it.
I'm struggling with how I pull my Jekyll posts into WP so they get a post ID assigned and can sync back to GitHub on post save. I feel like I have some YAML issues in the .md files I need to address (post_title
and published
) to ensure they get pulled in appropriately, but looking at what happened the first time, I see a ton of new stuff in the YAML file exported back to GitHub, which worries me.
What are the suggested steps for preparing the Jekyll blog for import and any tips on workflow would be appreciated!
When you "tried again" earlier, are you importing or exporting from the WordPress site? Is the WP site a fresh site? Can you walk me through the steps you took and what happened, starting from "I have Jekyll in a repo & (maybe?) a clean install of a WordPress site."? Given that this is not something I've done personally, a full picture of what steps you took would be helpful.
Hey, sorry. Missed your reply...
Here's how it went down: I've tried a few times to make this work, destroying and spinning up a new Digital Ocean droplet and installing WP fresh. The latest effort had me editing the memory limit on WP after install and then installing the WP Sync plugin, importing the Jekyll site at the end. Everything showed up as drafts with missing metadata (suspect it's bc the YAML fields didn't map from what I had to what is expected), for instance here's a post's YAML:
---
layout: post
title: Day 1
description: How it begins.
date: 2017-01-20
image:
twitter: /public/wtfjht-t.jpg
facebook: /public/wtfjht.jpg
---
After that, WP Sync made one giant commit back to GitHub, deleting basically everything (https://github.com/mkiser/jekyll-wp-test/commit/88b8edaabafd3636b262cbeb8634e05176dbe469) in the repo. Everything was in WP as a draft, still.
For clarity, this is an existing Jekyll site with hundreds of posts that I want to import into WP for WYSIWYG, and automatically sync back to Github.
Feels like the issue is with the lack of a WP-assigned post ID coming from the Jekyll markdown files, which then get assigned on import, and then dumped back into Github.
There's other weirdness, like the Title, Date, Description, and Images metadata getting mangled on the migration back and forth:
---
ID: 1500
post_title: Day 1
author: matt
post_date: 2017-01-20 00:59:22
post_excerpt: ""
layout: post
permalink: http://138.197.80.167/2017/01/20/day-1/
published: true
title:
- 'a:1:{i:0;s:5:"Day 1";}'
description:
- 'a:1:{i:0;s:14:"How it begins.";}'
date:
- 'a:1:{i:0;s:10:"2017-01-20";}'
image:
- 'a:1:{i:0;s:89:"a:2:{s:7:"twitter";s:20:"/public/wtfjht-t.jpg";s:8:"facebook";s:18:"/public/wtfjht.jpg";}";}'
---
I think the first issue is importing an existing Jekyll site and getting WP to assign post IDs. If having to go through and manually tag a few hundred posts with proper/additional YAML, cool. But then the second issue is the metadata getting totally destroyed, which is 😳.
Yeah, so there's a couple things:
If you update to the latest version of WPGHS, you won't get the weird-looking metadata exported, as we're no longer exporting custom meta. Also, the reason it's coming in so weird is it's getting serialized by PHP. Those weird strings is the PHP serialization format. However, you might still have import problems.
The reason everything is getting imported as a draft is there is no published
meta on the posts you're importing, so WPGHS assumes they're drafts.
Fixing the meta data may be resolvable through some custom code that maps meta data coming in to the meta internally, and does the same mapping on the way out. There are filters documentation in the wiki.
Handling said mapping is going to be the complicated part.
I still don't know why non-post files are getting deleted though. That one I'll have to investigate.
I'll spend some time looking into this and figuring out a solution. Since your repo is public, I can reproduce this myself pretty easily, so I'll give that a shot and see what I can come up with. In the meantime, hopefully the above info gives you someplace to look.
Thanks! I'll play around with cleaning up the YAML to see if I can get a clean import/export going on with a few posts later today/tomorrow.
Oh and just noticed that the plugin was rev'd last week – cool!
Hi, read pretty much every open and closed issue at this point. Can't get an export or an import to work no matter what I do. I get the following errors:
I have a fresh WP install on a Digital Ocean droplet with 2GB ram. Jekyll repo is here: https://github.com/mkiser/WTFJHT
Note: This isn't a GitHub page. It's a Jekyll blog w/ a Travis hook to built and deploy to S3. My goal is to import the
_posts
folder into WP for editing/creating and export it back to the folder as a .md file with YAML intact.I believe I have all the YAML needed here in this, the latest post: https://github.com/mkiser/WTFJHT/blob/master/_posts/2017-06-27-Day-159.md
I've followed every step for setting up the webhook, oauth token, secret, etc. and pretty sure that's a-ok. I even downgraded the WP install to the last know working version the plugin worked with. Any ideas about how to proceed? What am I missing?
thanks!