aboutsummaryrefslogtreecommitdiffstats
path: root/include/zot.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-11-27 02:51:16 -0800
committerfriendica <info@friendica.com>2013-11-27 02:51:16 -0800
commit64b467ea98fd4cf3cb6215be9ff8e5a9d13ba1a8 (patch)
tree5e97bc2b588b6f411c2529aa70af3b451a0003a2 /include/zot.php
parente3f5c4458bc637ca304b807d2125f332965e4126 (diff)
downloadvolse-hubzilla-64b467ea98fd4cf3cb6215be9ff8e5a9d13ba1a8.tar.gz
volse-hubzilla-64b467ea98fd4cf3cb6215be9ff8e5a9d13ba1a8.tar.bz2
volse-hubzilla-64b467ea98fd4cf3cb6215be9ff8e5a9d13ba1a8.zip
reduce the likelihood that a given channel will have 30-40 valid hublocs with the same hubloc_url.
Diffstat (limited to 'include/zot.php')
-rw-r--r--include/zot.php31
1 files changed, 9 insertions, 22 deletions
diff --git a/include/zot.php b/include/zot.php
index 65f3b606f..0e92b0bff 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -18,33 +18,20 @@ function zot_new_uid($channel_nick) {
/**
- *
- * Given an array of zot hashes, return all distinct hubs
- * If primary is true, return only primary hubs
- * Result is ordered by url to assist in batching.
- * Return only the first primary hub as there should only be one.
+ * @function zot_get_hublocs($hash)
+ * Given a zot hash, return all distinct hubs
+ * @param string $hash - xchan_hash
+ * @retuns array
*
*/
-function zot_get_hubloc($arr,$primary = false) {
-
- $tmp = '';
-
- if(is_array($arr)) {
- foreach($arr as $e) {
- if(strlen($tmp))
- $tmp .= ',';
- $tmp .= "'" . dbesc($e) . "'" ;
- }
- }
-
- if(! strlen($tmp))
- return array();
+function zot_get_hublocs($hash) {
- $sql_extra = (($primary) ? " and hubloc_flags & " . intval(HUBLOC_FLAGS_PRIMARY) : "" );
- $limit = (($primary) ? " limit 1 " : "");
- return q("select * from hubloc where hubloc_hash in ( $tmp ) $sql_extra order by hubloc_url $limit");
+ $ret = q("select * from hubloc where hubloc_hash = '%s' group by hubloc_url ",
+ dbesc($hash)
+ );
+ return $ret;
}
/*