Quote Originally Posted by pilou2 View Post
I did some quick fix so that PayPalr module does not do its checking every time you want to do some setting on other modules.
But I think a more efficient approach would be to do the API checking only when PayPalr module is installed or one of its settings is modified, and at most when it is selected. More than that and it is useless and just add a time penalty on all your other actions. Two or three modules doing this could render the admin modules page nearly unusable.
Here is the code I changed in
Code:
includes/modules/payment/paypalr.php
after line 293:
PHP Code:
        $this->enabled = ($this->enabled === true && $this->validateConfiguration($curl_installed));
        if (
$this->enabled && IS_ADMIN_FLAG === true) {
            
// register/update known webhooks
            
$this->ppr->registerAndUpdateSubscribedWebhooks();
        } 
to this:
PHP Code:
        if (IS_ADMIN_FLAG === false || ($this->enabled === true && $_GET['module'] === 'paypalr')) {
            
$this->enabled = ($this->enabled === true && $this->validateConfiguration($curl_installed));
            if (
$this->enabled && IS_ADMIN_FLAG === true) {
                
// register/update known webhooks
                
$this->ppr->registerAndUpdateSubscribedWebhooks();
            }
        } 
This just a quick fix for those who might have the same problem.
Forgot about this code, although it works when in admin module page, it will crash when editing an order that uses PayPal RESTful.
It seems that API initialization is taking time, validation is done at the same time but does not change much about delay...
I am adraid I am out of option.
Do you think it is possible to limit API connection to only when the module is actually used?