Use native Str::uuid() function

This commit is contained in:
DariusIII
2025-02-28 14:31:32 +01:00
parent 2c06ccee09
commit c44bee0b27
3 changed files with 2 additions and 16 deletions
+1 -1
View File
@@ -323,7 +323,7 @@ class NZBImport
protected function insertNZB($nzbDetails): bool
{
// Make up a GUID for the release.
$this->relGuid = createGUID();
$this->relGuid = Str::uuid()->toString();
// Remove part count from subject.
$partLess = preg_replace('/(\(\d+\/\d+\))*$/', 'yEnc', $nzbDetails['subject']);
+1 -1
View File
@@ -453,7 +453,7 @@ class ProcessReleases
'searchname' => $searchName,
'totalpart' => $collection->totalfiles,
'groups_id' => $collection->groups_id,
'guid' => createGUID(),
'guid' => Str::uuid()->toString(),
'postdate' => $collection->date,
'fromname' => $fromName,
'size' => $collection->filesize,
-14
View File
@@ -137,20 +137,6 @@ if (! function_exists('getUserBrowseOrdering')) {
}
}
if (! function_exists('createGUID')) {
/**
* @throws Exception
*/
function createGUID(): string
{
$data = random_bytes(16);
$data[6] = \chr(\ord($data[6]) & 0x0F | 0x40); // set version to 0100
$data[8] = \chr(\ord($data[8]) & 0x3F | 0x80); // set bits 6-7 to 10
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(sodium_bin2hex($data), 4));
}
}
if (! function_exists('getSimilarName')) {
/**
* @param string $name