fix: address code review feedback - guard billing_provision_trace, deduplicate password loop
Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/ce009e66-16ae-4ca7-a28c-5dac466cc014 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
7e4c29edc7
commit
91ed67d2eb
2 changed files with 15 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue