X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FItemURI.php;h=460ee1447004becb635d059fb63fd2705515748b;hb=2e05dac7dae0a3d028b442a2d5afbd4176a32e99;hp=a120bf02bf9d126ea9f6ace76740890badca4e1f;hpb=2a431b580f2e8f6a596e84175932e793678cde63;p=friendica.git diff --git a/src/Model/ItemURI.php b/src/Model/ItemURI.php index a120bf02bf..460ee14470 100644 --- a/src/Model/ItemURI.php +++ b/src/Model/ItemURI.php @@ -76,6 +76,27 @@ class ItemURI return self::insert(['uri' => $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']; } }