From 0a25442548ad000f8b933db7e490a52da010598a Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 24 Mar 2020 11:50:17 -0600 Subject: [PATCH] Update functions.php --- resources/functions.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/resources/functions.php b/resources/functions.php index 541d822fca..a2711fb58c 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -106,16 +106,22 @@ $uuid = null; $which_uuidgen = shell_exec("which uuidgen"); if (strlen($which_uuidgen) > 0) { - if (PHP_OS == 'FreeBSD') { + if (PHP_OS === 'FreeBSD') { $uuid = trim(shell_exec("uuidgen")); } - if (PHP_OS == 'Linux') { + if (PHP_OS === 'Linux') { $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')); } + if (function_exists('com_create_guid') === true && PHP_OS === 'Windows') { + $uuid = trim(com_create_guid(), '{}'); + } return $uuid; } }