ORANGECOLLAR/MODULE-WORDPRESS-INTEGRATION · DATA FLOW
Data Flow
Post Listing Flow
Browser -> GET /blog
-> Magento Router (matches base path)
-> Blog\Index Controller
-> PostRepository::getList(page, perPage)
-> WordPressCache::load('posts_page_1')
[cache hit] -> return cached Post[]
[cache miss] ->
-> Client::getPosts(['page' => 1, '_embed' => true])
-> GET /wp-json/wp/v2/posts?page=1&_embed=1
-> HTTP response
-> Post::fromApiResponse() for each post
-> WordPressCache::save(Post[], 'posts_page_1', [WORDPRESS_POST])
-> return Post[]
-> Assign posts to Block/ViewModel
-> Layout renders blog/index.phtml
-> Response to browser Single Post Flow
Browser -> GET /blog/my-post-slug
-> Magento Router
-> resolveRoute('my-post-slug') -> controller: post, action: view
-> Post\View Controller
-> PostRepository::getBySlug('my-post-slug')
-> WordPressCache::load('post_slug_my-post-slug')
[cache miss] ->
-> Client::getPostBySlug('my-post-slug')
-> GET /wp-json/wp/v2/posts?slug=my-post-slug&_embed=1
-> Client::getSeoMeta($post->id) [if SEO enabled]
-> GET /wp-json/oc-bridge/v1/seo/42
-> ContentProcessor::process($post->content)
-> WordPressCache::save(Post, key, [WORDPRESS_POST, WORDPRESS_POST_42])
-> SeoPlugin injects meta tags into page head
-> Layout renders blog/post/view.phtml Webhook Cache Purge Flow
WordPress (content saved)
-> save_post hook fires
-> OC_Bridge_Cache_Webhook::on_post_save()
-> wp_remote_post() non-blocking POST to Magento
Magento -> POST /wordpress/webhook/cachepurge
-> Webhook\CachePurge Controller
-> read X-OC-Bridge-Signature header
-> compute HMAC-SHA256(request body, api_key)
-> hash_equals(computed, received)
[fail] -> 401 response
[pass] ->
-> parse payload: object_type, object_id
-> map object_type to cache tags
-> Magento\Framework\App\Cache\TypeListInterface::invalidate(tags)
-> 200 OK response Cache Key Strategy
Cache keys use the pattern wp_{type}_{identifier}:
| Data | Cache Key Example |
|---|---|
| Post listing page 1 | wp_ |
| Post by slug | wp_ |
| Post by ID | wp_ |
| Category listing | wp_ |
| Category by slug | wp_ |
| Menu | wp_ |