SwiftModders Posted December 7, 2016 Share Posted December 7, 2016 Hi Guys, I am using the licensing addon for one of my products and I have an issue where the licensing addon is always calling remotely. I'll admit my PHP development skills are not the greatest so I may be doing it wrong. However, I used the sample code provided by WHMCS and I am calling it correctly in my addon. Not my addon checks in two areas: 1. The addon I created for the product 2. The hook called for the TPL files In both it checks to make sure the license is OK before doing its thing. However I've run into some issues where the page is taking too long to load. I have the localkey and licensekey both saving to the database, so shouldn't the licensing addon be checking the localkey first? Maybe my understanding of how it works is off. I have it set to do remote checks every 15 days which is the default. If anyone anyone out there is using the license addon as well, mind giving me a few pointers on how to make sure your product does not always call home and cause performance issues? If you need some code snippets I'll be sure to provide, but wanted to ask generally what the best practice is. I've followed a few tutorials, but so far no dice on getting the performance uptick. 0 Quote Link to comment Share on other sites More sharing options...
fireupjb Posted December 8, 2016 Share Posted December 8, 2016 Hi Guys, I am using the licensing addon for one of my products and I have an issue where the licensing addon is always calling remotely. I'll admit my PHP development skills are not the greatest so I may be doing it wrong. However, I used the sample code provided by WHMCS and I am calling it correctly in my addon. Not my addon checks in two areas: 1. The addon I created for the product 2. The hook called for the TPL files In both it checks to make sure the license is OK before doing its thing. However I've run into some issues where the page is taking too long to load. I have the localkey and licensekey both saving to the database, so shouldn't the licensing addon be checking the localkey first? Maybe my understanding of how it works is off. I have it set to do remote checks every 15 days which is the default. If anyone anyone out there is using the license addon as well, mind giving me a few pointers on how to make sure your product does not always call home and cause performance issues? If you need some code snippets I'll be sure to provide, but wanted to ask generally what the best practice is. I've followed a few tutorials, but so far no dice on getting the performance uptick. I have this same issue on all the addons i'm developing, right now it calls home every page load. Which obviously defeats the purpose of the code: // The number of days to wait between performing remote license checks $localkeydays = 3; // The number of days to allow failover for after local key expiry $allowcheckfaildays = 5; I mean I guess I could add code to check date difference... That is okay but not sure why the included license check code didnt put that in there if the variables were set. I'm also saving to the database. 0 Quote Link to comment Share on other sites More sharing options...
SwiftModders Posted December 8, 2016 Author Share Posted December 8, 2016 I have this same issue on all the addons i'm developing, right now it calls home every page load. Which obviously defeats the purpose of the code: // The number of days to wait between performing remote license checks $localkeydays = 3; // The number of days to allow failover for after local key expiry $allowcheckfaildays = 5; I mean I guess I could add code to check date difference... That is okay but not sure why the included license check code didnt put that in there if the variables were set. I'm also saving to the database. I was able to fix this by changing my database. I was saving the license key and local key in the database and it limited to 255 characters for the localkey column. By modifying the database to LONGTEXT I was able to make sure the entire string was saved correctly. Now it's perfect Hope that helps you! 0 Quote Link to comment Share on other sites More sharing options...
fireupjb Posted December 8, 2016 Share Posted December 8, 2016 Thanks Sir! Good find! Data type/Length wasnt even on my idea list. That fixed it for me as well! --- Kudos to you! 0 Quote Link to comment Share on other sites More sharing options...
mfoland Posted February 1, 2022 Share Posted February 1, 2022 This is what I did ALTER TABLE `configuration` CHANGE `LocalKey` `LocalKey` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; and I'm still having this issue... Anyone have any ideas? I'm taking a different approach, and calling routes from a init.php file, and requiring the License there as well. Sometimes, it'll throw up an error 503 lol. Working with routes making a request system like the one WHMCS has or useresponse 🙂 It should be noted I have this of course in License.php in my core folder function BWSLicensing_check_license($licensekey, $localkey='') { //--Global values from init.php global $LicenseAPI; global $postmd5hash; global $localkeydays; global $allowcheckfaildays; global $License_DIR; The values in my init.php are as follows $License_Server = "private"; $postmd5hash = "private"; $localkeydays = "4"; $allowcheckfaildays = "5"; Everything matches and calls to those values correctly in my License File. I didn't have this issue with my Square Module, so maybe this is a new learning curve for me. 0 Quote Link to comment Share on other sites More sharing options...
mfoland Posted February 1, 2022 Share Posted February 1, 2022 1 minute ago, mfoland said: This is what I did ALTER TABLE `configuration` CHANGE `LocalKey` `LocalKey` LONGTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; and I'm still having this issue... Anyone have any ideas? I'm taking a different approach, and calling routes from a init.php file, and requiring the License there as well. Sometimes, it'll throw up an error 503 lol. Working with routes making a request system like the one WHMCS has or useresponse 🙂 It should be noted I have this of course in License.php in my core folder function BWSLicensing_check_license($licensekey, $localkey='') { //--Global values from init.php global $LicenseAPI; global $postmd5hash; global $localkeydays; global $allowcheckfaildays; global $License_DIR; The values in my init.php are as follows $License_Server = "private"; $postmd5hash = "private"; $localkeydays = "4"; $allowcheckfaildays = "5"; Everything matches and calls to those values correctly in my License File. I didn't have this issue with my Square Module, so maybe this is a new learning curve for me. Fixed it. I had to grab the LocalKey out of my database, and took off the equals '' in $localkey 🙂 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.