kopia lustrzana https://github.com/nextcloud/social
Merge pull request #415 from nextcloud/feature/noid/use-uuid-from-trait
call uuid() froom TStringTools;pull/419/head
commit
f64923bc65
|
@ -171,6 +171,5 @@ class PersonInterface implements IActivityPubInterface {
|
|||
$this->cacheActorsRequest->deleteFromId($item->getId());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace OCA\Social\Model\ActivityPub;
|
|||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TPathTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use JsonSerializable;
|
||||
use OCA\Social\Exceptions\ActivityCantBeVerifiedException;
|
||||
use OCA\Social\Exceptions\InvalidOriginException;
|
||||
|
@ -45,6 +46,7 @@ class ACore extends Item implements JsonSerializable {
|
|||
|
||||
|
||||
use TArrayTools;
|
||||
use TStringTools;
|
||||
use TPathTools;
|
||||
|
||||
|
||||
|
@ -238,11 +240,7 @@ class ACore extends Item implements JsonSerializable {
|
|||
$base = $this->withoutEndSlash($this->withBeginSlash($base));
|
||||
}
|
||||
|
||||
$uuid = sprintf(
|
||||
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000,
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
||||
);
|
||||
$uuid = $this->uuid();
|
||||
|
||||
$this->setId($url . $base . '/' . $uuid);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace OCA\Social\Model;
|
|||
|
||||
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use DateTime;
|
||||
use JsonSerializable;
|
||||
|
||||
|
@ -45,6 +46,7 @@ class RequestQueue implements JsonSerializable {
|
|||
|
||||
|
||||
use TArrayTools;
|
||||
use TStringTools;
|
||||
|
||||
|
||||
const STATUS_STANDBY = 0;
|
||||
|
@ -162,11 +164,7 @@ class RequestQueue implements JsonSerializable {
|
|||
* @return RequestQueue
|
||||
*/
|
||||
public function resetToken(): RequestQueue {
|
||||
$uuid = sprintf(
|
||||
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000,
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
||||
);
|
||||
$uuid = $this->uuid();
|
||||
|
||||
$this->setToken($uuid);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace OCA\Social\Service;
|
|||
use daita\MySmallPhpTools\Exceptions\MalformedArrayException;
|
||||
use daita\MySmallPhpTools\Model\Request;
|
||||
use daita\MySmallPhpTools\Traits\TArrayTools;
|
||||
use daita\MySmallPhpTools\Traits\TStringTools;
|
||||
use Exception;
|
||||
use OCA\Social\Exceptions\CacheContentException;
|
||||
use OCA\Social\Exceptions\CacheContentMimeTypeException;
|
||||
|
@ -52,6 +53,7 @@ class CacheDocumentService {
|
|||
|
||||
|
||||
use TArrayTools;
|
||||
use TStringTools;
|
||||
|
||||
|
||||
/** @var IAppData */
|
||||
|
@ -103,11 +105,7 @@ class CacheDocumentService {
|
|||
*/
|
||||
public function saveRemoteFileToCache(string $url, &$mime = '') {
|
||||
|
||||
$filename = sprintf(
|
||||
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xfff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000,
|
||||
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
||||
);
|
||||
$filename = $this->uuid();
|
||||
|
||||
// creating a path aa/bb/cc/dd/ from the filename aabbccdd-0123-[...]
|
||||
$path = chunk_split(substr($filename, 0, 8), 2, '/');
|
||||
|
|
Ładowanie…
Reference in New Issue