*/
public static function getIdForURL(string $url)
{
+ // Avoid any database requests when the hostname isn't even part of the url.
+ if (!strpos($url, DI::baseUrl()->getHostname())) {
+ return 0;
+ }
+
$self = Contact::selectFirst(['uid'], ['self' => true, 'nurl' => Strings::normaliseLink($url)]);
if (!empty($self['uid'])) {
return $self['uid'];
*/
public static function getLastUpdate(array $data)
{
+ $uid = User::getIdForURL($data['url']);
+ if (!empty($uid)) {
+ $contact = Contact::selectFirst(['url', 'last-item'], ['self' => true, 'uid' => $uid]);
+ if (!empty($contact['last-item'])) {
+ return $contact['last-item'];
+ }
+ }
+
if ($lastUpdate = self::updateFromNoScrape($data)) {
return $lastUpdate;
}