}
}
+ // Mastodon
+ if ($server_url == "") {
+ $red = preg_replace("=(https?://)(.*)/users/(.*)=ism", "$1$2", $profile);
+ if ($red != $profile) {
+ $server_url = $red;
+ $network = NETWORK_OSTATUS;
+ }
+ }
+
return $server_url;
}
$versionparts = explode("-", $version);
$version = $versionparts[0];
}
+
+ if(stristr($line,'Server: Mastodon')) {
+ $platform = "Mastodon";
+ $network = NETWORK_OSTATUS;
+ // Mastodon doesn't reveal version numbers
+ $version = "";
+ }
}
}
}
function suggestion_query($uid, $start = 0, $limit = 80) {
- if(! $uid)
+ if (!$uid) {
return array();
+ }
+
+// Uncommented because the result of the queries are to big to store it in the cache.
+// We need to decide if we want to change the db column type or if we want to delete it.
+// $list = Cache::get("suggestion_query:".$uid.":".$start.":".$limit);
+// if (!is_null($list)) {
+// return $list;
+// }
$network = array(NETWORK_DFRN);
$network[] = NETWORK_OSTATUS;
$sql_network = implode("', '", $network);
- //$sql_network = "'".$sql_network."', ''";
$sql_network = "'".$sql_network."'";
+ /// @todo This query is really slow
+ // By now we cache the data for five minutes
$r = q("SELECT count(glink.gcid) as `total`, gcontact.* from gcontact
INNER JOIN `glink` ON `glink`.`gcid` = `gcontact`.`id`
where uid = %d and not gcontact.nurl in ( select nurl from contact where uid = %d )
intval($limit)
);
- if(count($r) && count($r) >= ($limit -1))
+ if (count($r) && count($r) >= ($limit -1)) {
+// Uncommented because the result of the queries are to big to store it in the cache.
+// We need to decide if we want to change the db column type or if we want to delete it.
+// Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $r, CACHE_FIVE_MINUTES);
+
return $r;
+ }
$r2 = q("SELECT gcontact.* FROM gcontact
INNER JOIN `glink` ON `glink`.`gcid` = `gcontact`.`id`
while (sizeof($list) > ($limit))
array_pop($list);
+// Uncommented because the result of the queries are to big to store it in the cache.
+// We need to decide if we want to change the db column type or if we want to delete it.
+// Cache::set("suggestion_query:".$uid.":".$start.":".$limit, $list, CACHE_FIVE_MINUTES);
return $list;
}