diff --git a/modules/billing/add_to_cart.php b/modules/billing/add_to_cart.php index a55b6e02..1f531e20 100644 --- a/modules/billing/add_to_cart.php +++ b/modules/billing/add_to_cart.php @@ -23,17 +23,14 @@ function billing_generate_password(): string $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $len = strlen($alphabet); $password = ''; - try { - for ($i = 0; $i < 6; $i++) { + for ($i = 0; $i < 6; $i++) { + try { $password .= $alphabet[random_int(0, $len - 1)]; - } - return $password; - } catch (Throwable $e) { - for ($i = 0; $i < 6; $i++) { + } catch (Throwable $e) { $password .= $alphabet[mt_rand(0, $len - 1)]; } - return $password; } + return $password; } function billing_normalize_duration(string $duration): array diff --git a/modules/billing/create_servers.php b/modules/billing/create_servers.php index cb903088..d9df1c21 100644 --- a/modules/billing/create_servers.php +++ b/modules/billing/create_servers.php @@ -192,15 +192,17 @@ if (!function_exists('billing_detect_install_state')) { $xml_abs = $panel_root . '/' . ltrim($xml_rel, '/'); } } - billing_provision_trace('billing_detect_install_state: XML path resolution.', array( - 'home_id' => intval($home_info['home_id'] ?? 0), - 'home_cfg_file' => $xml_cfg_file, - 'xml_rel_path' => $xml_rel, - 'xml_abs_path' => $xml_abs, - 'cwd' => getcwd(), - 'xml_file_exists' => file_exists($xml_abs), - 'xml_is_readable' => is_readable($xml_abs), - )); + if (function_exists('billing_provision_trace')) { + billing_provision_trace('billing_detect_install_state: XML path resolution.', array( + 'home_id' => intval($home_info['home_id'] ?? 0), + 'home_cfg_file' => $xml_cfg_file, + 'xml_rel_path' => $xml_rel, + 'xml_abs_path' => $xml_abs, + 'cwd' => getcwd(), + 'xml_file_exists' => file_exists($xml_abs), + 'xml_is_readable' => is_readable($xml_abs), + )); + } $server_xml = read_server_config($xml_abs); if (!$server_xml) { $state['reason'] = "Could not read server config XML; install completion cannot be verified. Tried: {$xml_abs}";