mAAdhaTTah / wordpress-github-sync

A WordPress plugin to sync content with a GitHub repository (or Jekyll site)
https://wordpress.org/plugins/wp-github-sync/
GNU General Public License v3.0
613 stars 99 forks source link

Export All Not Working, how to debug #175

Closed cvharris closed 7 years ago

cvharris commented 7 years ago

I have hesitated opening an issue about this for awhile even though I haven't been able to export my entire site for awhile.

I have a repo cvharris/derp it is just initialized with a Readme. If I try to Export to Github in bulk nothing happens. I see the notification that 'Export started' but nothing in the logs. I have checked wp-debug.log, mysql logs, and apache access and error logs.

Is there any way to further debug this? The site is rather large but I'm still only exporting posts and pages. What should I see that says it's at least trying?

mAAdhaTTah commented 7 years ago

Is WP_DEBUG enabled? If it isn't, nothing will get written to the logs. If you enable it, you should get log output that will help me debug the problem.

cvharris commented 7 years ago

Yes WP_DEBUG has been enabled. Nothing in the logs. Should I even see anything logged?

The site is hosted on a corporate in-house server. I'm trying to figure out if outbound HTTP calls might be blocked. The server can talk to https://api.github.com, but like I said nothing is getting logged. Where should I start troubleshooting?

litefeel commented 7 years ago

@cvharris you can found log in $siteroot/wp-content/debug.log

cvharris commented 7 years ago

Finding and reading 'debug.log' was not the issue, the issue is that nothing gets logged when clicking Export to Github. Sorry I wasn't clear earlier, but I've alreafy made sure the the WP_DEBUG process is working. I can get other plugins to write to it but this one isn't for some reason. Looking for help if there may be permissions or networking assumptions that might help me troubleshoot this.

mAAdhaTTah commented 7 years ago

Nothing gets output in the debug.log but there's no error message or anything indicating any sort of problem? Even a failed http connection would output an error of some kind. Very odd...

mAAdhaTTah commented 7 years ago

Another suggestion: if you have WP-CLI, try exporting via the command line and see if you get error in your terminal.

cvharris commented 7 years ago

Okay I'll give that a try

cvharris commented 7 years ago

Sorry it took me longer to get back to you, but WP-CLI did the trick! It was able to expose the underlying issue: I had implemented the wpghs_pre_import_meta hook and the wpghs_post_meta hook with the same function, but in the wpghs_post_meta the 2nd argument ($post) is not passed, so it was throwing a missing argument exception.

I did see though that, in spite of the error thrown on every post it tried to export it still says at the end that Starting full export to Github. That seems like it could be cleaned up to be more informative as to why the export failed. I can't be quite sure but I don't think I saw the Export to Github completed successfully message when the errors were being thrown.

You can close this issue if you want, or use it to track the errors thrown aren't logged or preventing the Starting full export to Github from being displayed

mAAdhaTTah commented 7 years ago

No worries! I'm surprised this wasn't getting logged to your debug.log, but other than that, we can't wrap everything in a try/catch to provide error messages, I don't think. Plus some of the errors you're likely to experience are not going to be catchable unless you're running PHP7 anyway.

Providing better error messages would be helpful, if there are messages I've written that aren't clear, but for something like this, there's not really much I can do.