This commit is contained in:
zotlabs 2018-09-06 21:27:09 -07:00
parent 75ecacd88c
commit 017f1a3c79

View file

@ -557,24 +557,13 @@ function alt_pager($i, $more = '', $less = '') {
*/
function item_message_id() {
try {
$hash = Uuid::uuid4()->toString();
} catch (UnsatisfiedDependencyException $e) {
$hash = random_string(48);
}
do {
$dups = false;
try {
$hash = Uuid::uuid4(Uuid::NAMESPACE_DNS, App::get_hostname())->toString();
} catch (UnsatisfiedDependencyException $e) {
$hash = random_string(48);
}
$mid = z_root() . '/item/' . $hash;
$r = q("SELECT id FROM item WHERE mid = '%s' LIMIT 1",
dbesc($mid));
if ($r) {
$dups = true;
}
} while ($dups === true);
$mid = z_root() . '/item/' . $hash;
return $mid;
}
@ -587,22 +576,12 @@ function item_message_id() {
* @return string a unique hash
*/
function photo_new_resource() {
do {
$found = false;
try {
$hash = Uuid::uuid4(Uuid::NAMESPACE_DNS, App::get_hostname())->toString();
} catch (UnsatisfiedDependencyException $e) {
$hash = random_string(48);
}
$r = q("SELECT id FROM photo WHERE resource_id = '%s' LIMIT 1",
dbesc($hash)
);
if ($r) {
$found = true;
}
} while ($found === true);
try {
$hash = Uuid::uuid4()->toString();
} catch (UnsatisfiedDependencyException $e) {
$hash = random_string(48);
}
return $hash;
}