Include license type in usage data#2168
Conversation
|
@truongwp Would it make sense to just put this in Pro instead? We can use the |
WalkthroughThe changes in this pull request involve a modification to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
classes/models/FrmUsage.php (1)
104-106: LGTM! Consider preserving both license values.The implementation safely enhances the usage data by including the readable license type when available. However, consider preserving both the boolean installation status and the readable type for better data tracking.
Here's a suggested improvement:
if ( method_exists( 'FrmProAddonsController', 'get_readable_license_type' ) ) { - $snap['active_license'] = FrmProAddonsController::get_readable_license_type(); + $snap['license_type'] = FrmProAddonsController::get_readable_license_type(); }This way:
active_licenseremains a boolean indicating if Pro is installedlicense_typeprovides the readable license type when available
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
classes/models/FrmUsage.php(1 hunks)
🔇 Additional comments (1)
classes/models/FrmUsage.php (1)
104-106: Verify usage and implementation.
Let's verify the usage of active_license field and the implementation of get_readable_license_type.
✅ Verification successful
Let me gather more information about the FrmProAddonsController class to understand its implementation better.
Changes are safe and properly implemented
The verification shows that:
- The
active_licensefield is used consistently inFrmUsage.phpfor tracking license information get_readable_license_type()is a valid method inFrmProAddonsController(defined in stubs.php)- The code properly checks for method existence before calling it
- The implementation follows the established pattern of license type handling across the codebase
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the usage of active_license field and get_readable_license_type implementation
# Check for other usages of active_license field in snapshot data
echo "Checking active_license field usage..."
rg "active_license" --type php
# Check the implementation of get_readable_license_type
echo "Checking get_readable_license_type implementation..."
ast-grep --pattern 'class FrmProAddonsController {
$$$
static function get_readable_license_type() {
$$$
}
$$$
}'
Length of output: 558
Script:
#!/bin/bash
# Search for FrmProAddonsController class definition and usage
echo "Searching for FrmProAddonsController class..."
rg "class FrmProAddonsController" --type php -A 5
# Search for any references to license type or readable license
echo "Searching for license type related code..."
rg "license.*type" --type php -i
Length of output: 7681
That makes sense. I changed here because I don't want to create an |
Fixes https://github.com/Strategy11/formidable-pro/issues/5519