瀏覽代碼

Update functions.php

FusionPBX 5 年之前
父節點
當前提交
4f7edc7d21
共有 1 個文件被更改,包括 9 次插入5 次删除
  1. 9 5
      resources/functions.php

+ 9 - 5
resources/functions.php

@@ -103,11 +103,15 @@
 
 
 	if (!function_exists('uuid')) {
 	if (!function_exists('uuid')) {
 		function uuid() {
 		function uuid() {
-			$sql .= 'select gen_random_uuid();';
-			$database = new database;
-			$uuid = $database->select($sql, null, 'column');
-			if (!is_uuid($uuid) && PHP_OS == 'FreeBSD') {
-				$uuid = trim(shell_exec("uuidgen"));
+			$uuid = null;
+			$which_uuidgen = shell_exec("which uuidgen");
+			if (strlen($which_uuidgen) > 0) {
+				if (PHP_OS == 'FreeBSD') {
+					$uuid = trim(shell_exec("uuidgen"));
+				}
+				if (PHP_OS == 'Linux') {
+					$uuid = trim(shell_exec("uuidgen -r"));
+				}
 			}
 			}
 			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'));