Jump to content

Licensing Addon Always Calls Remote


SwiftModders

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • 5 years later...

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.

Link to comment
Share on other sites

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 🙂

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated