PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
← All changes | includes/Core/Fallback/SubmitActionFallback.php +7 -25 3.2.03.3.1 View file →
@@ -27,15 +27,11 @@
27 27 if (get_option(self::MIGRATED_OPTION)) {
28 28 return;
29 29 }
30 30
31 - // This fallback runs on `init` (any request), but the schema migration that adds
32 - // `workflow_category` is gated behind an admin (`manage_options`) request. If a non-admin /
33 - // cron / frontend request reaches here first, the column is absent and the referenced-ids
34 - // query below would return a WP_Error — which, treated as "nothing referenced", would wrongly
35 - // deactivate every action. Ensure the schema exists first; if it still cannot be created, bail
36 - // WITHOUT marking migrated so a later (admin) request retries.
37 - if (!$this->workflowCategoryColumnReady()) {
31 + // A missing column makes the referenced-ids query error, which would read as "nothing
32 + // referenced" and disable every action. Bail without marking migrated so a later request retries.
33 + if (!$this->workflowSchemaReady()) {
38 34 return;
39 35 }
40 36
41 37 $referenced = $this->activeWorkflowReferencedIds();
@@ -51,28 +47,14 @@
51 47 update_option(self::MIGRATED_OPTION, true, false);
52 48 }
53 49
54 50 /**
55 - * Guarantee the `workflow_category` column exists before the migration reads it. Tries to run the
56 - * schema migration once if the column is missing (self-healing regardless of who serves the
57 - * request). Returns false if the column still cannot be found.
51 + * Self-heal the columns the referenced-ids query filters on (`workflow_category`,
52 + * `workflow_status`); false when they still cannot be created, so the caller retries later.
58 53 */
59 - private function workflowCategoryColumnReady()
54 + private function workflowSchemaReady()
60 55 {
61 - if ($this->hasWorkflowCategoryColumn()) {
62 - return true;
63 - }
64 - // Column missing: run the schema migration now (idempotent) instead of waiting for an admin hit.
65 - DB::migrate();
66 - return $this->hasWorkflowCategoryColumn();
67 - }
68 -
69 - private function hasWorkflowCategoryColumn()
70 - {
71 - global $wpdb;
72 - $table = $wpdb->prefix . 'bitforms_workflows';
73 - // Table/column name interpolation only — SHOW COLUMNS cannot be parameterized via prepare().
74 - return null !== $wpdb->get_var("SHOW COLUMNS FROM `{$table}` LIKE 'workflow_category'");
56 + return DB::ensureWorkflowSchema();
75 57 }
76 58
77 59 /**
78 60 * Ids referenced by ANY ACTIVE classic/basic workflow success action (global, ids are unique).