]> git.mxchange.org Git - friendica.git/commitdiff
Improve contact search speed / assume octet-stream on missing content type
authorMichael <heluecht@pirati.ca>
Thu, 27 Jan 2022 04:05:11 +0000 (04:05 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 27 Jan 2022 04:05:11 +0000 (04:05 +0000)
src/Module/Search/Acl.php
src/Util/ParseUrl.php

index 4fbc30ef9ee68c67975171b7ec77ad817cbe593c..f00c9f9ecb1c98b0f25d900d7c32d9e85728a88d 100644 (file)
@@ -110,7 +110,7 @@ class Acl extends BaseModule
                        $search = $_REQUEST['query'];
                }
 
-               Logger::info('ACL {action} - {subaction}', ['module' => 'acl', 'action' => 'content', 'subaction' => 'search', 'search' => $search, 'type' => $type, 'conversation' => $conv_id]);
+               Logger::info('ACL {action} - {subaction} - start', ['module' => 'acl', 'action' => 'content', 'subaction' => 'search', 'search' => $search, 'type' => $type, 'conversation' => $conv_id]);
 
                $sql_extra = '';
                $condition       = ["`uid` = ? AND NOT `deleted` AND NOT `pending` AND NOT `archive`", local_user()];
@@ -207,7 +207,7 @@ class Acl extends BaseModule
                        foreach ($r as $g) {
                                $entry = [
                                        'type'    => 'c',
-                                       'photo'   => Contact::getMicro($g),
+                                       'photo'   => Contact::getMicro($g, true),
                                        'name'    => htmlspecialchars($g['name']),
                                        'id'      => intval($g['id']),
                                        'network' => $g['network'],
@@ -268,7 +268,7 @@ class Acl extends BaseModule
                                if (count($contact) > 0) {
                                        $unknown_contacts[] = [
                                                'type'    => 'c',
-                                               'photo'   => Contact::getMicro($contact),
+                                               'photo'   => Contact::getMicro($contact, true),
                                                'name'    => htmlspecialchars($contact['name']),
                                                'id'      => intval($contact['id']),
                                                'network' => $contact['network'],
@@ -304,6 +304,7 @@ class Acl extends BaseModule
                        'items' => $results['items'],
                ];
 
+               Logger::info('ACL {action} - {subaction} - done', ['module' => 'acl', 'action' => 'content', 'subaction' => 'search', 'search' => $search, 'type' => $type, 'conversation' => $conv_id]);
                return $o;
        }
 }
index 2763f56abf52aefc8090779b7fca8090906478ab..24be55cab931ced253b360a51070f93852dcb0d0 100644 (file)
@@ -72,7 +72,7 @@ class ParseUrl
 
                $contenttype =  $curlResult->getHeader('Content-Type')[0] ?? '';
                if (empty($contenttype)) {
-                       return [];
+                       return ['application', 'octet-stream'];
                }
 
                return explode('/', current(explode(';', $contenttype)));