| @@ -17,18 +17,11 @@ | ||
| 17 | 17 | * feature, so nothing legitimately maps to 'advanced' during this one-time upgrade. |
| 18 | 18 | */ |
| 19 | 19 | public function normalizeCategory() |
| 20 | 20 | { |
| 21 | - // Runs on `init` (any request), but the `workflow_category` column is added by a migration gated | |
| 22 | - // behind an admin request. Ensure the column exists first (self-heal) so a non-admin/cron first | |
| 23 | - // request does not silently no-op and leave rows uncategorized. | |
| 24 | - global $wpdb; | |
| 25 | - $table = $wpdb->prefix . 'bitforms_workflows'; | |
| 26 | - if (null === $wpdb->get_var("SHOW COLUMNS FROM `{$table}` LIKE 'workflow_category'")) { | |
| 27 | - DB::migrate(); | |
| 28 | - if (null === $wpdb->get_var("SHOW COLUMNS FROM `{$table}` LIKE 'workflow_category'")) { | |
| 29 | - return ''; | |
| 30 | - } | |
| 21 | + // Self-heal `workflow_category` first, else this pass silently leaves rows uncategorized. | |
| 22 | + if (!DB::ensureWorkflowSchema()) { | |
| 23 | + return ''; | |
| 31 | 24 | } |
| 32 | 25 | |
| 33 | 26 | $workFlowModel = new WorkFlowModel(); |
| 34 | 27 | $workFlows = $workFlowModel->get( |