aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-05-01 01:16:47 -0700
committerfriendica <info@friendica.com>2012-05-01 01:16:47 -0700
commit584ac68ae4a230c7a61b2720be8bac3de34d68da (patch)
tree745b62f66fdf9662f38a3cebb34426cadd50c10e /include
parentf175af05f92384fab7adb75390a8aa52dc1bd7e1 (diff)
downloadvolse-hubzilla-584ac68ae4a230c7a61b2720be8bac3de34d68da.tar.gz
volse-hubzilla-584ac68ae4a230c7a61b2720be8bac3de34d68da.tar.bz2
volse-hubzilla-584ac68ae4a230c7a61b2720be8bac3de34d68da.zip
adding zrl support to social graphs
Diffstat (limited to 'include')
-rw-r--r--include/onepoll.php2
-rw-r--r--include/socgraph.php38
2 files changed, 25 insertions, 15 deletions
diff --git a/include/onepoll.php b/include/onepoll.php
index 51516d059..42bce0f68 100644
--- a/include/onepoll.php
+++ b/include/onepoll.php
@@ -506,7 +506,7 @@ function onepoll_run($argv, $argc){
}
if(count($r)) {
if(! $r[0]['total']) {
- poco_load($contact['id'],$importer_uid,$contact['poco']);
+ poco_load($contact['id'],$importer_uid,0,$contact['poco']);
}
}
diff --git a/include/socgraph.php b/include/socgraph.php
index 3f5194049..4ab378098 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -20,7 +20,7 @@ require_once('include/datetime.php');
-function poco_load($cid,$uid = 0,$url = null) {
+function poco_load($cid,$uid = 0,$zcid = 0,$url = null) {
$a = get_app();
if($cid) {
@@ -128,35 +128,45 @@ function poco_load($cid,$uid = 0,$url = null) {
if(! $gcid)
return;
- $r = q("select * from glink where `cid` = %d and `uid` = %d and `gcid` = %d limit 1",
+ $r = q("select * from glink where `cid` = %d and `uid` = %d and `gcid` = %d and `zcid` = %d limit 1",
intval($cid),
intval($uid),
- intval($gcid)
+ intval($gcid),
+ intval($zcid)
);
if(! count($r)) {
- q("insert into glink ( `cid`,`uid`,`gcid`,`updated`) values (%d,%d,%d,'%s') ",
+ q("insert into glink ( `cid`,`uid`,`gcid`,`zcid`, `updated`) values (%d,%d,%d,%d, '%s') ",
intval($cid),
intval($uid),
intval($gcid),
+ intval($zcid),
dbesc(datetime_convert())
);
}
else {
- q("update glink set updated = '%s' where `cid` = %d and `uid` = %d and `gcid` = %d limit 1",
+ q("update glink set updated = '%s' where `cid` = %d and `uid` = %d and `gcid` = %d and zcid = %d limit 1",
dbesc(datetime_convert()),
intval($cid),
intval($uid),
- intval($gcid)
+ intval($gcid),
+ intval($zcid)
);
}
}
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
- q("delete from glink where `cid` = %d and `uid` = %d and `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY",
- intval($cid),
- intval($uid)
- );
+ if($zcid) {
+ q("delete from glink where `zcid` = %d and `updated` < UTC_TIMESTAMP - INTERVAL 14 DAY",
+ intval($zcid)
+ );
+ }
+ else {
+ q("delete from glink where `cid` = %d and `uid` = %d and `updated` < UTC_TIMESTAMP - INTERVAL 2 DAY",
+ intval($cid),
+ intval($uid)
+ );
+ }
}
@@ -254,7 +264,7 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
$r2 = q("SELECT gcontact.* from gcontact
left join glink on glink.gcid = gcontact.id
- where glink.uid = 0 and glink.cid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d )
+ where glink.uid = 0 and glink.cid = 0 and glink.zcid = 0 and not gcontact.nurl in ( select nurl from contact where uid = %d )
and not gcontact.name in ( select name from contact where uid = %d )
and not gcontact.id in ( select gcid from gcign where uid = %d )
order by rand() limit %d, %d ",
@@ -276,7 +286,7 @@ function update_suggestions() {
$done = array();
- poco_load(0,0,$a->get_baseurl() . '/poco');
+ poco_load(0,0,0,$a->get_baseurl() . '/poco');
$done[] = $a->get_baseurl() . '/poco';
@@ -288,7 +298,7 @@ function update_suggestions() {
foreach($j->entries as $entry) {
$url = $entry->url . '/poco';
if(! in_array($url,$done))
- poco_load(0,0,$entry->url . '/poco');
+ poco_load(0,0,0,$entry->url . '/poco');
}
}
}
@@ -302,7 +312,7 @@ function update_suggestions() {
foreach($r as $rr) {
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
if(! in_array($base,$done))
- poco_load(0,0,$base);
+ poco_load(0,0,0,$base);
}
}
}