-
Notifications
You must be signed in to change notification settings - Fork 78
PRESIDECMS-3215: Fix webflow step sync site-tenancy caching bug and add migration for orphaned steps #1726
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: stable
Are you sure you want to change the base?
PRESIDECMS-3215: Fix webflow step sync site-tenancy caching bug and add migration for orphaned steps #1726
Changes from 2 commits
09cc13d
33901f4
50ff132
7da572e
61cd141
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /** | ||
| * @feature webflow | ||
| */ | ||
| component { | ||
|
|
||
| property name="sqlRunner" inject="SqlRunner"; | ||
|
|
||
| private void function run() { | ||
| var dsn = getPresideObject( "webflow_configuration" ).getDsn(); | ||
|
|
||
| // Step 1: Update orphaned steps to point to correct configuration | ||
| // These are steps where the step's site doesn't match the configuration's site | ||
| sqlRunner.runSql( | ||
| dsn = dsn | ||
| , sql = " | ||
| UPDATE webflow_configuration_step wcs | ||
| INNER JOIN webflow_configuration wc_current ON wc_current.id = wcs.webflow | ||
| INNER JOIN webflow_configuration wc_correct ON wc_correct.webflow_id = wc_current.webflow_id | ||
| AND wc_correct.site = wcs.site | ||
| AND wc_correct.is_singleton = 1 | ||
| AND wc_correct.instance_ref IS NULL | ||
| SET wcs.webflow = wc_correct.id | ||
| WHERE wc_current.site != wcs.site | ||
| AND wc_current.is_singleton = 1 | ||
| AND wc_current.instance_ref IS NULL | ||
| " | ||
| ); | ||
|
|
||
| // Step 2: Delete duplicate steps (keep ones pointing to correct config) | ||
| // This handles cases where both old orphaned and new correct steps exist | ||
| sqlRunner.runSql( | ||
| dsn = dsn | ||
| , sql = " | ||
| DELETE wcs_old FROM webflow_configuration_step wcs_old | ||
| INNER JOIN webflow_configuration_step wcs_new ON wcs_new.step_id = wcs_old.step_id | ||
| AND wcs_new.site = wcs_old.site | ||
| AND wcs_new.id != wcs_old.id | ||
| INNER JOIN webflow_configuration wc_old ON wc_old.id = wcs_old.webflow | ||
| INNER JOIN webflow_configuration wc_new ON wc_new.id = wcs_new.webflow | ||
| WHERE wc_old.webflow_id = wc_new.webflow_id | ||
| AND wc_old.site != wcs_old.site | ||
| AND wc_new.site = wcs_new.site | ||
| " | ||
| ); | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -779,16 +779,22 @@ component { | |
| } | ||
|
|
||
| private struct function _getExistingSingletonFlowForStartupCheck( required string webflowId ) { | ||
| var currentSiteId = $getRequestContext().getSiteId(); | ||
|
||
|
|
||
| if ( !StructKeyExists( request, "_webflowSingletonsStartupCache" ) ) { | ||
| request._webflowSingletonsStartupCache = {}; | ||
| } | ||
|
|
||
| if ( !StructKeyExists( request._webflowSingletonsStartupCache, currentSiteId ) ) { | ||
| request._webflowSingletonsStartupCache[ currentSiteId ] = {}; | ||
|
|
||
| var rawflows = $getPresideObject( "webflow_configuration" ).selectData( filter="instance_ref is null" ); | ||
| for( var f in rawFlows ) { | ||
| request._webflowSingletonsStartupCache[ f.webflow_id ] = f; | ||
| request._webflowSingletonsStartupCache[ currentSiteId ][ f.webflow_id ] = f; | ||
|
||
| } | ||
| } | ||
|
|
||
| return request._webflowSingletonsStartupCache[ arguments.webflowId ] ?: {}; | ||
| return request._webflowSingletonsStartupCache[ currentSiteId ][ arguments.webflowId ] ?: {}; | ||
| } | ||
|
|
||
| private struct function _getExistingNonSingletonFlowForStartupCheck( required string webflowId, required string instanceRef, string siteId="" ) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.