mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Use native Str::uuid() function
This commit is contained in:
@@ -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']);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user