X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FItemURI.php;h=d57df4c4251c47b918449ca4e8a1a38f959a510a;hb=6dbbd081795fa1c8fe57db2248ac162efeeada88;hp=a120bf02bf9d126ea9f6ace76740890badca4e1f;hpb=38a5358bfa646ae13a4a1a385741890fa88d9b7f;p=friendica.git diff --git a/src/Model/ItemURI.php b/src/Model/ItemURI.php index a120bf02bf..d57df4c425 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']; } }