1
0
Fork 0

separate dfrn introductions from email when it comes to expiration of blocked requests

This commit is contained in:
friendica 2011-12-11 23:33:56 -08:00
parent a38d3b82b9
commit cbdc667ba2

View file

@ -252,12 +252,16 @@ function dfrn_request_post(&$a) {
* *
* Cleanup old introductions that remain blocked. * Cleanup old introductions that remain blocked.
* Also remove the contact record, but only if there is no existing relationship * Also remove the contact record, but only if there is no existing relationship
* * Do not remove email contacts as these may be awaiting email verification
*/ */
$r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel` $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id` FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0 AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE "); WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` != '%s'
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
dbesc(NETWORK_MAIL)
);
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
if(! $rr['rel']) { if(! $rr['rel']) {
@ -271,6 +275,32 @@ function dfrn_request_post(&$a) {
} }
} }
/**
*
* Cleanup any old email intros - which will have a greater lifetime
*/
$r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
AND `contact`.`network` = '%s'
AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
dbesc(NETWORK_MAIL)
);
if(count($r)) {
foreach($r as $rr) {
if(! $rr['rel']) {
q("DELETE FROM `contact` WHERE `id` = %d LIMIT 1",
intval($rr['cid'])
);
}
q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1",
intval($rr['iid'])
);
}
}
$url = trim($_POST['dfrn_url']); $url = trim($_POST['dfrn_url']);
if(! strlen($url)) { if(! strlen($url)) {
notice( t("Invalid locator") . EOL ); notice( t("Invalid locator") . EOL );