-
Notifications
You must be signed in to change notification settings - Fork 2
Export Wordpress #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Export Wordpress #25
Conversation
Use Flask to listen for REST notifications when a wordpress website is updated. Then pull in the current version of the website posts via standard wordpress REST api. Write the info out as json in shared_directory/lang directories. Push to git.
Use Flask to listen for REST notifications when a wordpress website is updated. Then pull in the current version of the website posts via standard wordpress REST api. Write the info out as json in shared_directory/lang directories. Push to git.
Update steve/ingest-wordpress from master
… into steve/ingest-wordpress
Update translation
…api/export-wordpress
def post(self): | ||
|
||
post_data = request.json | ||
id=post_data.get("id") | ||
lang=post_data.get("lang") | ||
message = { | ||
"content": post_data.get("content"), | ||
"title": post_data.get("title"), | ||
"excerpt": post_data.get("excerpt"), | ||
"status": post_data.get("status") | ||
} | ||
|
||
return do_export(id, lang, message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than receiving the text of the message from a post() parameter, we need to get it from the file system. For instance, here are some examples of spanish (es) output files.
https://github.com/nyc-cto/tms-data/tree/aditya/development/local/source_files/es
I've been using the "wp" prefix to indicate wordpress files. Can you read the json from them?
In our Docker setup, this tms-data git branch gets checked out under /var/tms-data/source_files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: actually triggering the code to run -- Ideally we need our Serge wrapper to hit your rest api here. Can you ask Aditya about the best place for the call to happen? If there's no good place to put the hook, we can instead use a celery/cron-ish timer to run your code periodically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good. I'll check in with Aditya.
@@ -208,7 +208,7 @@ jobs | |||
# plugin for more information. | |||
data | |||
{ | |||
path_matches \/(about|title|description)$ | |||
path_matches \/(about|wptitle|content|description)$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this? You inherited this from my branch, but I took it out.
@@ -0,0 +1,118 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So are Cyber Command / DoITT ok with us installing this custom code on our wpengine instance? What is the approval process? Do we need to go through an approval process every time we change the code?
If I wanted to add my own custom php function (say, manually building my own simple "webhook" by hitting a hard coded endpoint every time a wordpress post is edited), would that be ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, according to @jisaf the process of having this go through Cyber would be more streamlined compared to if we are to use plugins that are not within WPEngine because it's worked by an unapproved third party
When you rebase against master, ingestion/ingest_wordpress.py will have moved to import_export/import_wordpress.py Can you make a new file export_wordpress.py and move your py code there? |
@nyccto-rapicastillo is this PR still valid or should it be closed? |
Background
Allows exporting translations to Wordpress .
Two components:
Sample Flask Request
You would need to run
~/ingestion/ingest-wordpress.py
in order to execute this.TODO