$person = self::person_by_handle($msg_author);
+ dba::lock('mail');
+
$r = q("SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($msg_guid),
intval($importer["uid"])
dbesc($msg_created_at)
);
+ dba::unlock();
+
q("UPDATE `conv` SET `updated` = '%s' WHERE `id` = %d",
dbesc(datetime_convert()),
intval($conversation["id"])
return false;
}
+ $body = diaspora2bb($text);
+
+ $body = self::replace_people_guid($body, $person["url"]);
+
+ dba::lock('mail');
+
$r = q("SELECT `id` FROM `mail` WHERE `guid` = '%s' AND `uid` = %d LIMIT 1",
dbesc($guid),
intval($importer["uid"])
return false;
}
- $body = diaspora2bb($text);
-
- $body = self::replace_people_guid($body, $person["url"]);
-
q("INSERT INTO `mail` (`uid`, `guid`, `convid`, `from-name`,`from-photo`,`from-url`,`contact-id`,`title`,`body`,`seen`,`reply`,`uri`,`parent-uri`,`created`)
VALUES ( %d, '%s', %d, '%s', '%s', '%s', %d, '%s', '%s', %d, %d, '%s','%s','%s')",
intval($importer["uid"]),
dbesc($created_at)
);
+ dba::unlock();
+
q("UPDATE `conv` SET `updated` = '%s' WHERE `id` = %d",
dbesc(datetime_convert()),
intval($conversation["id"])