Merge pull request #7588 from annando/reduce-load

Follow up to #7582: Only update the contact when needed
This commit is contained in:
Philipp 2019-08-31 11:46:40 +02:00 committed by GitHub
commit 3ee26ecd24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -904,7 +904,7 @@ class Contact extends BaseObject
public static function unmarkForArchival(array $contact)
{
// Always unarchive the relay contact entry
if (!empty($contact['batch'])) {
if (!empty($contact['batch']) && !empty($contact['term-date']) && ($contact['term-date'] > DBA::NULL_DATETIME)) {
$fields = ['term-date' => DBA::NULL_DATETIME, 'archive' => false];
$condition = ['batch' => $contact['batch'], 'contact-type' => self::TYPE_RELAY];
DBA::update('contact', $fields, $condition);