X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FItemURI.php;h=460ee1447004becb635d059fb63fd2705515748b;hb=41062eb7e4036946711afefd529de5c9a89b7b9d;hp=6421b2dbd9a5007cafd463ff04d62bc7a0c43043;hpb=122ad0af14f046c2462a03fe33967dc41abfc8b5;p=friendica.git diff --git a/src/Model/ItemURI.php b/src/Model/ItemURI.php index 6421b2dbd9..460ee14470 100644 --- a/src/Model/ItemURI.php +++ b/src/Model/ItemURI.php @@ -1,6 +1,6 @@ $uri]); } + return $itemuri['id']; + } + /** + * Searched for an id of a given guid. + * + * @param string $guid + * + * @return integer item-uri id + * @throws \Exception + */ + public static function getIdByGUID($guid) + { + // If the GUID gets too long we only take the first parts and hope for best + $guid = substr($guid, 0, 255); + + $itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => $guid]); + + if (!DBA::isResult($itemuri)) { + return 0; + } + return $itemuri['id']; } }