Hello, please help me with next issue
Let's imagine i have custom script which interacting with WHMCS... ( WHMCS 7.1.2 )
<?php
define('CLIENTAREA', true);
define('WHMCS_ROOT_DIR', dirname(dirname(__FILE__)));
require WHMCS_ROOT_DIR . '/init.php';
$result = \localApi('GetOrders', array('userid' => $user_id, 'id' => $order_id), 'administrator');
long_running_function(); // runing about 10 minutes
$result = \localApi('GetOrders', array('userid' => $user_id, 'id' => $order_id), 'administrator');
?>
It's abstract code to reproduce issue. Let's see what's happened. First call of "LocalApi" return "success" as expected
But after "long_running_function" ends then second call of "LocalApi" return error with message "No matching admin user found"
And console output says me next: "# PHP Warning: mysql_fetch_array() expects parameter to be resource, boolean was given. in /home/whmcs/web/public_html/includes/dbcompatfunctions.php on line 0"
It's seems to be because mysql lost default connection after long time of waiting and "localApi" function can't get id of provided user. So how i can reestablish connection to continue use of "localApi" function?
Using of before second call of localApi Capsule::connection()->reconnect(); has no effect