-
Notifications
You must be signed in to change notification settings - Fork 41
Usage tracking for test mode in Lite #2941
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
Changes from all commits
5e53f41
716a2fe
477764b
da35035
d6425e3
0b49f80
31d79d9
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 |
|---|---|---|
|
|
@@ -88,6 +88,17 @@ | |
| } | ||
| ?> | ||
| </select> | ||
|
|
||
| <?php | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @truongwp This is for the add-on tracking? Can we add a new hook here instead so we can move this logic into the add-on?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @truongwp Like the hook is only called if That would be fine. Otherwise I'm not sure if I follow.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Crabcyborg No. I meant we won't need to add a hook there, just check
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just think there's a difference. This file is intended to use the whole UI, as it's shown in Lite as disabled placeholders. And these inputs are only used when the add-on is actually active, and have no visual benefit for being in Lite. Since they only impact the add-on, it would be nice if we only needed to modify the add-on when we needed to make changes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. I added the hook and moved the code to the add-on. |
||
| /** | ||
| * Fires inside the enabled form actions container. | ||
| * | ||
| * @since x.x | ||
| * | ||
| * @param array $form_actions | ||
| */ | ||
| do_action( 'frm_testmode_form_actions', $form_actions ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ?> | ||
| </div> | ||
| </label> | ||
| </div> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Make usage-counter updates concurrency-safe.
At Lines [99-100] and [148-151], both new events use
FrmUsageController::update_flows_data(). That method reads the flows option, increments the value, and writes it back in separate operations. Concurrent test-mode views can overwrite each other and undercountview_test_mode.Update the counter atomically, or use storage that supports concurrent increments, before relying on these new call sites.
Also applies to: 148-151
🧰 Tools
🪛 ast-grep (0.45.0)
[warning] 100-100: Avoid side effects in a file that defines symbols
Context: echo '
Note: [CWE-710] Improper Adherence to Coding Standards.
(no-side-effect)
🤖 Prompt for AI Agents
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Strategy11/formidable-forms
Length of output: 10698
🏁 Script executed:
Repository: Strategy11/formidable-forms
Length of output: 50384
🏁 Script executed:
Repository: Strategy11/formidable-forms
Length of output: 50384
🏁 Script executed:
Repository: Strategy11/formidable-forms
Length of output: 5969
🏁 Script executed:
Repository: Strategy11/formidable-forms
Length of output: 7116
🏁 Script executed:
Repository: Strategy11/formidable-forms
Length of output: 50384
🏁 Script executed:
Repository: Strategy11/formidable-forms
Length of output: 5403
Gate test-mode usage tracking to preview-only requests.
The
frm_filter_final_formlistener runs fromshow_form(), which is used by ajax preview, error redraws, and AJAX success returns. Those repeated AJAX renders also hitrender_testing_mode_container()whentestmodeis present, so each render can incrementview_test_mode. Track only the initial preview render, or gate the update by request context.🧰 Tools
🪛 ast-grep (0.45.0)
[warning] 100-100: Avoid side effects in a file that defines symbols
Context: echo '
Note: [CWE-710] Improper Adherence to Coding Standards.
(no-side-effect)
🤖 Prompt for AI Agents