aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-01-22 20:48:03 -0800
committerfriendica <info@friendica.com>2013-01-22 20:48:03 -0800
commitd06c21dc39b21d58f4c50e0f243a1d95c4137a6b (patch)
tree0be8e36e6443769fe8f9c0e8f008cdc8de5d1da0 /include
parentd43591fb0f5c552b1c725dc2cbaeaea8fe441319 (diff)
downloadvolse-hubzilla-d06c21dc39b21d58f4c50e0f243a1d95c4137a6b.tar.gz
volse-hubzilla-d06c21dc39b21d58f4c50e0f243a1d95c4137a6b.tar.bz2
volse-hubzilla-d06c21dc39b21d58f4c50e0f243a1d95c4137a6b.zip
some poco fixes
Diffstat (limited to 'include')
-rw-r--r--include/onepoll.php8
-rw-r--r--include/socgraph.php77
2 files changed, 42 insertions, 43 deletions
diff --git a/include/onepoll.php b/include/onepoll.php
index 4b44ff5b9..019fe8ed3 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -113,16 +113,14 @@ function onepoll_run($argv, $argc){
// set last updated timestamp
- $r = null;
-
if($contact['xchan_connurl']) {
$r = q("SELECT xlink_id from xlink
where xlink_xchan = '%s' and xlink_updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
intval($contact['xchan_hash'])
);
- }
- if($r) {
- poco_load($contact['xchan_hash'],$contact['xchan_connurl']);
+ if($r) {
+ poco_load($contact['xchan_hash'],$contact['xchan_connurl']);
+ }
}
return;
diff --git a/include/socgraph.php b/include/socgraph.php
index aa5a24e89..081927dcc 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -23,12 +23,11 @@ function poco_load($xchan = null,$url = null) {
$a = get_app();
if($xchan && ! $url) {
- $r = q("select xchan_connurl from xchan where xchan_hash = %d limit 1",
- intval($xchan)
+ $r = q("select xchan_connurl from xchan where xchan_hash = '%s' limit 1",
+ dbesc($xchan)
);
if($r) {
$url = $r[0]['xchan_connurl'];
- $uid = $r[0]['abook_channel'];
}
}
@@ -109,24 +108,25 @@ function poco_load($xchan = null,$url = null) {
}
- $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' limit 1",
- dbesc($xchan),
- dbesc($hash)
- );
- if(! $r) {
- q("insert into xlink ( xlink_xchan, xlink_link, xlink_updated ) values ( '%s', '%s', '%s' ) ",
+ if($xchan) {
+ $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' limit 1",
dbesc($xchan),
- dbesc($hash),
- dbesc(datetime_convert())
- );
- }
- else {
- q("update xlink set xlink_updated = '%s' where xlink_id = %d limit 1",
- dbesc(datetime_convert()),
- intval($r[0]['xlink_id'])
+ dbesc($hash)
);
+ if(! $r) {
+ q("insert into xlink ( xlink_xchan, xlink_link, xlink_updated ) values ( '%s', '%s', '%s' ) ",
+ dbesc($xchan),
+ dbesc($hash),
+ dbesc(datetime_convert())
+ );
+ }
+ else {
+ q("update xlink set xlink_updated = '%s' where xlink_id = %d limit 1",
+ dbesc(datetime_convert()),
+ intval($r[0]['xlink_id'])
+ );
+ }
}
-
}
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
@@ -295,37 +295,38 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
function update_suggestions() {
+// FIXME
+return;
$a = get_app();
$done = array();
- poco_load(0,0,0,$a->get_baseurl() . '/poco');
+ // fix this to get a json list from an upstream directory
+// poco_load(0,0,0,$a->get_baseurl() . '/poco');
- $done[] = $a->get_baseurl() . '/poco';
+// $done[] = $a->get_baseurl() . '/poco';
- if(strlen(get_config('system','directory_submit_url'))) {
- $x = fetch_url('http://dir.friendica.com/pubsites');
- if($x) {
- $j = json_decode($x);
- if($j->entries) {
- foreach($j->entries as $entry) {
- $url = $entry->url . '/poco';
- if(! in_array($url,$done))
- poco_load(0,0,0,$entry->url . '/poco');
- }
- }
- }
- }
+// if(strlen(get_config('system','directory_submit_url'))) {
+// $x = fetch_url('http://dir.friendica.com/pubsites');
+// if($x) {
+// $j = json_decode($x);
+// if($j->entries) {
+// foreach($j->entries as $entry) {
+// $url = $entry->url . '/poco';
+// if(! in_array($url,$done))
+// poco_load(0,0,0,$entry->url . '/poco');
+// }
+// }
+// }
+// }
- $r = q("select distinct(poco) as poco from contact where network = '%s'",
- dbesc(NETWORK_DFRN)
- );
+ $r = q("select distinct(xchan_connurl) as poco from xchan where xchan_network = 'zot'");
- if(count($r)) {
+ if($r) {
foreach($r as $rr) {
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
if(! in_array($base,$done))
- poco_load(0,0,0,$base);
+ poco_load('',$base);
}
}
}