provide storage for directory based reputation in the xlink table by setting xlink_static = 1, so that xlink_static = 0 is traditional poco linkages
This commit is contained in:
parent
9f5bfca28d
commit
0596097f86
2
boot.php
2
boot.php
@ -49,7 +49,7 @@ define ( 'RED_PLATFORM', 'redmatrix' );
|
|||||||
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
||||||
define ( 'ZOT_REVISION', 1 );
|
define ( 'ZOT_REVISION', 1 );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1134 );
|
define ( 'DB_UPDATE_VERSION', 1135 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant with a HTML line break.
|
* Constant with a HTML line break.
|
||||||
|
@ -145,7 +145,7 @@ function onepoll_run($argv, $argc){
|
|||||||
|
|
||||||
if($contact['xchan_connurl']) {
|
if($contact['xchan_connurl']) {
|
||||||
$r = q("SELECT xlink_id from xlink
|
$r = q("SELECT xlink_id from xlink
|
||||||
where xlink_xchan = '%s' and xlink_updated > %s - INTERVAL %s limit 1",
|
where xlink_xchan = '%s' and xlink_updated > %s - INTERVAL %s and xlink_static = 0 limit 1",
|
||||||
intval($contact['xchan_hash']),
|
intval($contact['xchan_hash']),
|
||||||
db_utcnow(), db_quoteinterval('1 DAY')
|
db_utcnow(), db_quoteinterval('1 DAY')
|
||||||
);
|
);
|
||||||
|
@ -160,7 +160,7 @@ function poller_run($argv, $argc){
|
|||||||
|
|
||||||
// get rid of really old poco records
|
// get rid of really old poco records
|
||||||
|
|
||||||
q("delete from xlink where xlink_updated < %s - INTERVAL %s",
|
q("delete from xlink where xlink_updated < %s - INTERVAL %s and xlink_static = 0 ",
|
||||||
db_utcnow(), db_quoteinterval('14 DAY')
|
db_utcnow(), db_quoteinterval('14 DAY')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -186,13 +186,13 @@ function poco_load($xchan = '',$url = null) {
|
|||||||
$total ++;
|
$total ++;
|
||||||
|
|
||||||
|
|
||||||
$r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' limit 1",
|
$r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 0 limit 1",
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
dbesc($hash)
|
dbesc($hash)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated ) values ( '%s', '%s', %d, '%s', '%s' ) ",
|
q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', 0 ) ",
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
dbesc($hash),
|
dbesc($hash),
|
||||||
intval($rating),
|
intval($rating),
|
||||||
@ -211,7 +211,7 @@ function poco_load($xchan = '',$url = null) {
|
|||||||
}
|
}
|
||||||
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
|
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
|
||||||
|
|
||||||
q("delete from xlink where xlink_xchan = '%s' and xlink_updated < %s - INTERVAL %s",
|
q("delete from xlink where xlink_xchan = '%s' and xlink_updated < %s - INTERVAL %s and xlink_static = 0",
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
db_utcnow(), db_quoteinterval('2 DAY')
|
db_utcnow(), db_quoteinterval('2 DAY')
|
||||||
);
|
);
|
||||||
@ -222,7 +222,7 @@ function poco_load($xchan = '',$url = null) {
|
|||||||
|
|
||||||
function count_common_friends($uid,$xchan) {
|
function count_common_friends($uid,$xchan) {
|
||||||
|
|
||||||
$r = q("SELECT count(xlink_id) as total from xlink where xlink_xchan = '%s' and xlink_link in
|
$r = q("SELECT count(xlink_id) as total from xlink where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in
|
||||||
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_flags = 0 )",
|
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_flags = 0 )",
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
@ -243,7 +243,7 @@ function common_friends($uid,$xchan,$start = 0,$limit=100000000,$shuffle = false
|
|||||||
else
|
else
|
||||||
$sql_extra = " order by xchan_name asc ";
|
$sql_extra = " order by xchan_name asc ";
|
||||||
|
|
||||||
$r = q("SELECT * from xchan left join xlink on xlink_link = xchan_hash where xlink_xchan = '%s' and xlink_link in
|
$r = q("SELECT * from xchan left join xlink on xlink_link = xchan_hash where xlink_xchan = '%s' and xlink_static = 0 and xlink_link in
|
||||||
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_flags = 0 ) $sql_extra limit %d offset %d",
|
(select abook_xchan from abook where abook_xchan != '%s' and abook_channel = %d and abook_flags = 0 ) $sql_extra limit %d offset %d",
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
dbesc($xchan),
|
dbesc($xchan),
|
||||||
@ -340,6 +340,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
|
|||||||
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
|
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
|
||||||
and not xlink_link in ( select xchan from xign where uid = %d )
|
and not xlink_link in ( select xchan from xign where uid = %d )
|
||||||
and xlink_xchan != ''
|
and xlink_xchan != ''
|
||||||
|
and xlink_static = 0
|
||||||
and not ( xchan_flags & %d )>0
|
and not ( xchan_flags & %d )>0
|
||||||
and not ( xchan_flags & %d )>0
|
and not ( xchan_flags & %d )>0
|
||||||
group by xchan_hash order by total desc limit %d offset %d ",
|
group by xchan_hash order by total desc limit %d offset %d ",
|
||||||
@ -360,6 +361,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
|
|||||||
where xlink_xchan = ''
|
where xlink_xchan = ''
|
||||||
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
|
and not xlink_link in ( select abook_xchan from abook where abook_channel = %d )
|
||||||
and not xlink_link in ( select xchan from xign where uid = %d )
|
and not xlink_link in ( select xchan from xign where uid = %d )
|
||||||
|
and xlink_static = 0
|
||||||
and not ( xchan_flags & %d )>0
|
and not ( xchan_flags & %d )>0
|
||||||
and not ( xchan_flags & %d )>0
|
and not ( xchan_flags & %d )>0
|
||||||
group by xchan_hash order by total desc limit %d offset %d ",
|
group by xchan_hash order by total desc limit %d offset %d ",
|
||||||
@ -405,7 +407,7 @@ function update_suggestions() {
|
|||||||
// the targets may have changed their preferences and don't want to be suggested - and they
|
// the targets may have changed their preferences and don't want to be suggested - and they
|
||||||
// may have simply gone away.
|
// may have simply gone away.
|
||||||
|
|
||||||
$r = q("delete from xlink where xlink_xchan = '' and xlink_updated < %s - INTERVAL %s",
|
$r = q("delete from xlink where xlink_xchan = '' and xlink_updated < %s - INTERVAL %s and xlink_static = 0",
|
||||||
db_utcnow(), db_quoteinterval('7 DAY')
|
db_utcnow(), db_quoteinterval('7 DAY')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1532,11 +1532,13 @@ CREATE TABLE IF NOT EXISTS `xlink` (
|
|||||||
`xlink_rating` int(11) NOT NULL DEFAULT '0',
|
`xlink_rating` int(11) NOT NULL DEFAULT '0',
|
||||||
`xlink_rating_text` TEXT NOT NULL DEFAULT '',
|
`xlink_rating_text` TEXT NOT NULL DEFAULT '',
|
||||||
`xlink_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`xlink_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`xlink_static` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`xlink_id`),
|
PRIMARY KEY (`xlink_id`),
|
||||||
KEY `xlink_xchan` (`xlink_xchan`),
|
KEY `xlink_xchan` (`xlink_xchan`),
|
||||||
KEY `xlink_link` (`xlink_link`),
|
KEY `xlink_link` (`xlink_link`),
|
||||||
KEY `xlink_updated` (`xlink_updated`),
|
KEY `xlink_updated` (`xlink_updated`),
|
||||||
KEY `xlink_rating` (`xlink_rating`)
|
KEY `xlink_rating` (`xlink_rating`),
|
||||||
|
KEY `xlink_static` (`xlink_static`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
@ -1145,12 +1145,14 @@ CREATE TABLE "xlink" (
|
|||||||
"xlink_rating" bigint NOT NULL DEFAULT '0',
|
"xlink_rating" bigint NOT NULL DEFAULT '0',
|
||||||
"xlink_rating_text" TEXT NOT NULL DEFAULT '',
|
"xlink_rating_text" TEXT NOT NULL DEFAULT '',
|
||||||
"xlink_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
"xlink_updated" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
|
"xlink_static" numeric(1) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY ("xlink_id")
|
PRIMARY KEY ("xlink_id")
|
||||||
);
|
);
|
||||||
create index "xlink_xchan" on xlink ("xlink_xchan");
|
create index "xlink_xchan" on xlink ("xlink_xchan");
|
||||||
create index "xlink_link" on xlink ("xlink_link");
|
create index "xlink_link" on xlink ("xlink_link");
|
||||||
create index "xlink_updated" on xlink ("xlink_updated");
|
create index "xlink_updated" on xlink ("xlink_updated");
|
||||||
create index "xlink_rating" on xlink ("xlink_rating");
|
create index "xlink_rating" on xlink ("xlink_rating");
|
||||||
|
create index "xlink_static" on xlink ("xlink_static");
|
||||||
CREATE TABLE "xperm" (
|
CREATE TABLE "xperm" (
|
||||||
"xp_id" serial NOT NULL,
|
"xp_id" serial NOT NULL,
|
||||||
"xp_client" varchar( 20 ) NOT NULL DEFAULT '',
|
"xp_client" varchar( 20 ) NOT NULL DEFAULT '',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1134 );
|
define( 'UPDATE_VERSION' , 1135 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -1537,3 +1537,14 @@ function update_r1133() {
|
|||||||
return UPDATE_FAILED;
|
return UPDATE_FAILED;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_r1134() {
|
||||||
|
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
|
||||||
|
$r = q("ALTER TABLE xlink ADD xlink_static numeric(1) NOT NULL DEFAULT '0', create index xlink_static on xlink ( \"xlink_static\" ) ");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$r = q("ALTER TABLE xlink ADD xlink_static TINYINT( 1 ) NOT NULL DEFAULT '0', ADD INDEX ( xlink_static ) ");
|
||||||
|
if($r)
|
||||||
|
return UPDATE_SUCCESS;
|
||||||
|
return UPDATE_FAILED;
|
||||||
|
}
|
Reference in New Issue
Block a user