Merge remote-tracking branch 'upstream/develop' into update-self

This commit is contained in:
Michael 2018-03-24 22:50:14 +00:00
commit a0451e1c62
159 changed files with 7123 additions and 4877 deletions

View file

@ -1582,4 +1582,29 @@ class Contact extends BaseObject
}
}
}
/**
* Remove the unavailable contact ids from the provided list
*
* @param array $contact_ids Contact id list
*/
public static function pruneUnavailable(array &$contact_ids)
{
if (empty($contact_ids)) {
return;
}
$str = dbesc(implode(',', $contact_ids));
$stmt = dba::p("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0");
$return = [];
while($contact = dba::fetch($stmt)) {
$return[] = $contact['id'];
}
dba::close($stmt);
$contact_ids = $return;
}
}