-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bake posts, pages and blocks from WP API snapshots (#3166)
This PR bakes all remaining Wordpress posts, pages and blocks from API snapshots saved by the previous PR in the stack. The full API response is saved in the database, from which we can extract the content of the post, page or block. We are currently [evaluating a git-based workflow to edit, override and keep track of the content part of the snapshot](https://www.notion.so/owid/2024-02-02-Baking-and-editing-Wordpress-API-snapshots-5c92d90280774d209b7aca22f65f71dd?pvs=4#603bd407f20043bc93d4c8aaf07127ce), but this will be tackled separately. This PR also deprecates the old Wordpress API functions, and moves them to a separate file for clarity. It is important to note that these snapshots are not replacing or superseding the `post.content` column in the database. What was previously in the `post.content` column is still there, and is still the source of truth for the code paths that used it (e.g. the WP HTML source -> ArchieML migration). The snapshots are only used as a static drop-in replacement for dynamic Wordpress API calls, which were happening during the rendering of posts, pages and blocks. Depending on the remaining scope of the overall migration effort, we might decide to set up programmatic guardrails to address this source of truth issue, or simply document the caveats of the approach for the migration team. ## Testing - [x] run `syncPostsToGrapher` - [x] rebake full site on http://staging-site-bake-from-snapshot, e.g. http://staging-site-bake-from-snapshot/personal-relations-econ-outcomes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced new post retrieval and processing functions across various components for enhanced performance and maintainability. - **Refactor** - Replaced deprecated WordPress database operation functions with new modular functions in the API, baker, and database layers. - Updated post retrieval methods to use snapshots and modular functions for better efficiency and clarity. - Deprecated several functions related to querying WordPress tables or APIs in favor of new, optimized methods. - **Documentation** - Updated interface `DbEnrichedPost` to include a new property for API snapshots and added related utility functions. - **Bug Fixes** - Adjusted function calls related to post-related charts and post citability checks to ensure accuracy and reliability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
15 changed files
with
581 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.