Update functions.php

This commit is contained in:
FusionPBX 2020-03-24 11:50:17 -06:00 committed by GitHub
parent 692897efbf
commit 0a25442548
1 changed files with 9 additions and 3 deletions

View File

@ -106,16 +106,22 @@
$uuid = null; $uuid = null;
$which_uuidgen = shell_exec("which uuidgen"); $which_uuidgen = shell_exec("which uuidgen");
if (strlen($which_uuidgen) > 0) { if (strlen($which_uuidgen) > 0) {
if (PHP_OS == 'FreeBSD') { if (PHP_OS === 'FreeBSD') {
$uuid = trim(shell_exec("uuidgen")); $uuid = trim(shell_exec("uuidgen"));
} }
if (PHP_OS == 'Linux') { if (PHP_OS === 'Linux') {
$uuid = trim(shell_exec("uuidgen -r")); $uuid = trim(shell_exec("uuidgen -r"));
} }
if (!is_uuid($uuid)) {
$uuid = trim(shell_exec("uuidgen"));
}
} }
if (!is_uuid($uuid) && PHP_OS == 'Linux') { if (!is_uuid($uuid) && PHP_OS === 'Linux') {
$uuid = trim(file_get_contents('/proc/sys/kernel/random/uuid')); $uuid = trim(file_get_contents('/proc/sys/kernel/random/uuid'));
} }
if (function_exists('com_create_guid') === true && PHP_OS === 'Windows') {
$uuid = trim(com_create_guid(), '{}');
}
return $uuid; return $uuid;
} }
} }