Contact::unmarkForArchival($contact);
}
+ // Unarchive the contact if it is a toplevel posting
+ if ($arr["parent-uri"] === $arr["uri"]) {
+ $contact = dba::select('contact', [], ['id' => $arr["contact-id"]], ['limit' => 1]);
+ if ($contact['term-date'] > NULL_DATE) {
+ Contact::unmarkForArchival($contact);
+ }
+ }
+
$update = (!$arr['private'] && (($arr["author-link"] === $arr["owner-link"]) || ($arr["parent-uri"] === $arr["uri"])));
// Is it a forum? Then we don't care about the rules from above
*/
public static function markForArchival(array $contact)
{
- // Contact already archived, nothing to do
- if ($contact['archive']) {
+ // Contact already archived or "self" contact? => nothing to do
+ if ($contact['archive'] || $contact['self']) {
return;
}
dba::update('contact', array('term-date' => datetime_convert()), array('id' => $contact['id']));
if ($contact['url'] != '') {
- dba::update('contact', array('term-date' => datetime_convert()), array('`nurl` = ? AND `term-date` <= ?', normalise_link($contact['url']), NULL_DATE));
+ dba::update('contact', array('term-date' => datetime_convert()), array('`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE));
}
} else {
/* @todo
dba::update('contact', array('archive' => 1), array('id' => $contact['id']));
if ($contact['url'] != '') {
- dba::update('contact', array('archive' => 1), array('nurl' => normalise_link($contact['url'])));
+ dba::update('contact', array('archive' => 1), array('nurl' => normalise_link($contact['url']), 'self' => false));
}
}
}