adding zrl support to social graphs
This commit is contained in:
parent
f175af05f9
commit
584ac68ae4
5 changed files with 39 additions and 18 deletions
2
boot.php
2
boot.php
|
@ -11,7 +11,7 @@ require_once('include/cache.php');
|
||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_VERSION', '2.3.1328' );
|
define ( 'FRIENDICA_VERSION', '2.3.1328' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1141 );
|
define ( 'DB_UPDATE_VERSION', 1142 );
|
||||||
|
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
|
|
@ -384,11 +384,13 @@ CREATE TABLE IF NOT EXISTS `glink` (
|
||||||
`cid` int(11) NOT NULL,
|
`cid` int(11) NOT NULL,
|
||||||
`uid` int(11) NOT NULL,
|
`uid` int(11) NOT NULL,
|
||||||
`gcid` int(11) NOT NULL,
|
`gcid` int(11) NOT NULL,
|
||||||
|
`zcid` int(11) NOT NULL,
|
||||||
`updated` datetime NOT NULL,
|
`updated` datetime NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `cid` (`cid`),
|
KEY `cid` (`cid`),
|
||||||
KEY `uid` (`uid`),
|
KEY `uid` (`uid`),
|
||||||
KEY `gcid` (`gcid`),
|
KEY `gcid` (`gcid`),
|
||||||
|
KEY `zcid` (`zcid`),
|
||||||
KEY `updated` (`updated`)
|
KEY `updated` (`updated`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
|
@ -506,7 +506,7 @@ function onepoll_run($argv, $argc){
|
||||||
}
|
}
|
||||||
if(count($r)) {
|
if(count($r)) {
|
||||||
if(! $r[0]['total']) {
|
if(! $r[0]['total']) {
|
||||||
poco_load($contact['id'],$importer_uid,$contact['poco']);
|
poco_load($contact['id'],$importer_uid,0,$contact['poco']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
$a = get_app();
|
||||||
|
|
||||||
if($cid) {
|
if($cid) {
|
||||||
|
@ -128,35 +128,45 @@ function poco_load($cid,$uid = 0,$url = null) {
|
||||||
if(! $gcid)
|
if(! $gcid)
|
||||||
return;
|
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($cid),
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval($gcid)
|
intval($gcid),
|
||||||
|
intval($zcid)
|
||||||
);
|
);
|
||||||
if(! count($r)) {
|
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($cid),
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval($gcid),
|
intval($gcid),
|
||||||
|
intval($zcid),
|
||||||
dbesc(datetime_convert())
|
dbesc(datetime_convert())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
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()),
|
dbesc(datetime_convert()),
|
||||||
intval($cid),
|
intval($cid),
|
||||||
intval($uid),
|
intval($uid),
|
||||||
intval($gcid)
|
intval($gcid),
|
||||||
|
intval($zcid)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
|
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",
|
if($zcid) {
|
||||||
intval($cid),
|
q("delete from glink where `zcid` = %d and `updated` < UTC_TIMESTAMP - INTERVAL 14 DAY",
|
||||||
intval($uid)
|
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
|
$r2 = q("SELECT gcontact.* from gcontact
|
||||||
left join glink on glink.gcid = gcontact.id
|
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.name in ( select name from contact where uid = %d )
|
||||||
and not gcontact.id in ( select gcid from gcign where uid = %d )
|
and not gcontact.id in ( select gcid from gcign where uid = %d )
|
||||||
order by rand() limit %d, %d ",
|
order by rand() limit %d, %d ",
|
||||||
|
@ -276,7 +286,7 @@ function update_suggestions() {
|
||||||
|
|
||||||
$done = array();
|
$done = array();
|
||||||
|
|
||||||
poco_load(0,0,$a->get_baseurl() . '/poco');
|
poco_load(0,0,0,$a->get_baseurl() . '/poco');
|
||||||
|
|
||||||
$done[] = $a->get_baseurl() . '/poco';
|
$done[] = $a->get_baseurl() . '/poco';
|
||||||
|
|
||||||
|
@ -288,7 +298,7 @@ function update_suggestions() {
|
||||||
foreach($j->entries as $entry) {
|
foreach($j->entries as $entry) {
|
||||||
$url = $entry->url . '/poco';
|
$url = $entry->url . '/poco';
|
||||||
if(! in_array($url,$done))
|
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) {
|
foreach($r as $rr) {
|
||||||
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
|
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
|
||||||
if(! in_array($base,$done))
|
if(! in_array($base,$done))
|
||||||
poco_load(0,0,$base);
|
poco_load(0,0,0,$base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
update.php
11
update.php
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1141 );
|
define( 'UPDATE_VERSION' , 1142 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -1230,3 +1230,12 @@ function update_1140() {
|
||||||
return UPDATE_FAILED ;
|
return UPDATE_FAILED ;
|
||||||
return UPDATE_SUCCESS ;
|
return UPDATE_SUCCESS ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1141() {
|
||||||
|
$r = q("alter table glink add zcid int(11) not null after gcid, add index(zcid) ");
|
||||||
|
if(! $r)
|
||||||
|
return UPDATE_FAILED ;
|
||||||
|
return UPDATE_SUCCESS ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue