X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=include%2Ftext.php;h=3aec42b3239b1fbee986d15b60183f53f05fc9fa;hb=f9bd6894de9e56bbbee4379e878c6d1f5703f51b;hp=21111ba63181f3317a5cfdda78f4b8e7b7c5079f;hpb=598a9f76a68668cb13073e6832138869435ba5ee;p=friendica.git diff --git a/include/text.php b/include/text.php index 21111ba631..3aec42b323 100644 --- a/include/text.php +++ b/include/text.php @@ -717,10 +717,15 @@ function logger($msg,$level = 0) { if((! $debugging) || (! $logfile) || ($level > $loglevel)) return; + $process_id = session_id(); + + if ($process_id == "") + $process_id = get_app()->process_id; + $callers = debug_backtrace(); $logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n", datetime_convert(), - session_id(), + $process_id, $LOGGER_LEVELS[$level], basename($callers[0]['file']), $callers[0]['line'], @@ -867,7 +872,8 @@ function contact_block() { $micropro = Null; } else { - $r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` + // Splitting the query in two parts makes it much faster + $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `hidden` AND NOT `archive` AND `network` IN ('%s', '%s', '%s') ORDER BY RAND() LIMIT %d", @@ -877,11 +883,19 @@ function contact_block() { dbesc(NETWORK_DIASPORA), intval($shown) ); - if(count($r)) { - $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total); - $micropro = Array(); - foreach($r as $rr) { - $micropro[] = micropro($rr,true,'mpfriend'); + if ($r) { + $contacts = ""; + foreach ($r AS $contact) + $contacts[] = $contact["id"]; + + $r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)", + dbesc(implode(",", $contacts))); + if(count($r)) { + $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total); + $micropro = Array(); + foreach($r as $rr) { + $micropro[] = micropro($rr,true,'mpfriend'); + } } } }