pubsubhubbub db refinements
This commit is contained in:
parent
465ba71b58
commit
632c557008
2
boot.php
2
boot.php
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
|
||||||
define ( 'BUILD_ID' , 1004 );
|
define ( 'BUILD_ID' , 1005 );
|
||||||
|
|
||||||
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' );
|
||||||
|
|
11
database.sql
11
database.sql
|
@ -69,6 +69,9 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
||||||
`confirm` text NOT NULL,
|
`confirm` text NOT NULL,
|
||||||
`aes_allow` tinyint(1) NOT NULL DEFAULT '0',
|
`aes_allow` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`ret-aes` tinyint(1) NOT NULL DEFAULT '0',
|
`ret-aes` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`usehub` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`subhub` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`hub-verify` char(255) NOT NULL,
|
||||||
`last-update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`last-update` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`name-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`name-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
`uri-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
`uri-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
@ -80,7 +83,13 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
||||||
`rating` tinyint(1) NOT NULL DEFAULT '0',
|
`rating` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`reason` text NOT NULL,
|
`reason` text NOT NULL,
|
||||||
`profile-id` int(11) NOT NULL DEFAULT '0',
|
`profile-id` int(11) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `uid` (`uid`),
|
||||||
|
KEY `self` (`self`),
|
||||||
|
KEY `issued-id` (`issued-id`),
|
||||||
|
KEY `dfrn-id` (`dfrn-id`),
|
||||||
|
KEY `blocked` (`blocked`),
|
||||||
|
KEY `readonly` (`readonly`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
$contacts = q("SELECT * FROM `contact`
|
$contacts = q("SELECT * FROM `contact`
|
||||||
WHERE ( `dfrn-id` != '' OR (`issued-id` != '' AND `duplex` = 1))
|
WHERE ( `dfrn-id` != '' OR (`issued-id` != '' AND `duplex` = 1))
|
||||||
AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 AND `usehub` = 0 ORDER BY RAND()");
|
AND `self` = 0 AND `blocked` = 0 AND `readonly` = 0 AND `subhub` = 0 ORDER BY RAND()");
|
||||||
|
|
||||||
if(! count($contacts))
|
if(! count($contacts))
|
||||||
killme();
|
killme();
|
||||||
|
|
|
@ -67,7 +67,7 @@ function pubsub_init(&$a) {
|
||||||
if(($hub_mode === 'unsubscribe') && (! strlen($hub_verify)))
|
if(($hub_mode === 'unsubscribe') && (! strlen($hub_verify)))
|
||||||
hub_return(false, '');
|
hub_return(false, '');
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `usehub` = %d WHERE `id` = %d LIMIT 1",
|
$r = q("UPDATE `contact` SET `subhub` = %d WHERE `id` = %d LIMIT 1",
|
||||||
intval($subscribe),
|
intval($subscribe),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
|
@ -93,7 +93,7 @@ function pubsub_post(&$a) {
|
||||||
|
|
||||||
$importer = $r[0];
|
$importer = $r[0];
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `usehub` = 1 AND `id` = %d AND `uid` = %d AND `blocked` = 0 LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `subhub` = 1 AND `id` = %d AND `uid` = %d AND `blocked` = 0 LIMIT 1",
|
||||||
intval($contact_id),
|
intval($contact_id),
|
||||||
intval($importer['uid'])
|
intval($importer['uid'])
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,4 +29,8 @@ function update_1003() {
|
||||||
q("ALTER TABLE `contact` ADD `hub-verify` CHAR( 255 ) NOT NULL AFTER `usehub`");
|
q("ALTER TABLE `contact` ADD `hub-verify` CHAR( 255 ) NOT NULL AFTER `usehub`");
|
||||||
q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )");
|
q("ALTER TABLE `contact` ADD INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )");
|
||||||
q("ALTER TABLE `contact` ADD INDEX ( `blocked` ), ADD INDEX ( `readonly` )");
|
q("ALTER TABLE `contact` ADD INDEX ( `blocked` ), ADD INDEX ( `readonly` )");
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_1004() {
|
||||||
|
q("ALTER TABLE `contact` ADD `subhub` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `usehub`");
|
||||||
}
|
}
|
Loading…
Reference in a new issue