]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Contact.php
Merge pull request #8071 from nupplaphil/task/Lock_to_lock
[friendica.git] / src / Model / Contact.php
index 6cda8e404f8c15cb964fb26932a293aba55be1df..0540bf7bebd3f812a50be9da135acdbf1284c939 100644 (file)
@@ -2220,7 +2220,7 @@ class Contact
        {
                $result = ['cid' => -1, 'success' => false, 'message' => ''];
 
-               $a = \get_app();
+               $a = DI::app();
 
                // remove ajax junk, e.g. Twitter
                $url = str_replace('/#!/', '/', $url);
@@ -2682,26 +2682,23 @@ class Contact
         * Remove the unavailable contact ids from the provided list
         *
         * @param array $contact_ids Contact id list
+        * @return array
         * @throws \Exception
         */
-       public static function pruneUnavailable(array &$contact_ids)
+       public static function pruneUnavailable(array $contact_ids)
        {
                if (empty($contact_ids)) {
-                       return;
-               }
-
-               $str = DBA::escape(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'];
+                       return [];
                }
 
-               DBA::close($stmt);
+               $contacts = Contact::selectToArray(['id'], [
+                       'id'      => $contact_ids,
+                       'blocked' => false,
+                       'pending' => false,
+                       'archive' => false,
+               ]);
 
-               $contact_ids = $return;
+               return array_column($contacts, 'id');
        }
 
        /**