Browse Source

pubsubhubbub db refinements

pull/1/head
Mike Macgirvin 11 years ago
parent
commit
632c557008
  1. 2
      boot.php
  2. 11
      database.sql
  3. 2
      include/poller.php
  4. 4
      mod/pubsub.php
  5. 4
      update.php

2
boot.php

@ -2,7 +2,7 @@
set_time_limit(0);
define ( 'BUILD_ID' , 1004 );
define ( 'BUILD_ID' , 1005 );
define ( 'EOL', "<br />\r\n");
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

11
database.sql

@ -69,6 +69,9 @@ CREATE TABLE IF NOT EXISTS `contact` (
`confirm` text NOT NULL,
`aes_allow` 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',
`name-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',
`reason` text NOT NULL,
`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;
-- --------------------------------------------------------

2
include/poller.php

@ -23,7 +23,7 @@
$contacts = q("SELECT * FROM `contact`
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))
killme();

4
mod/pubsub.php

@ -67,7 +67,7 @@ function pubsub_init(&$a) {
if(($hub_mode === 'unsubscribe') && (! strlen($hub_verify)))
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($contact['id'])
);
@ -93,7 +93,7 @@ function pubsub_post(&$a) {
$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($importer['uid'])
);

4
update.php

@ -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 INDEX ( `uid` ) , ADD INDEX ( `self` ), ADD INDEX ( `issued-id` ), ADD INDEX ( `dfrn-id` )");
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…
Cancel
Save