We really can't do this without a hubloc. I was hoping we could, but notifier is setup to take hublocs, not xchans.

This commit is contained in:
friendica 2014-08-22 21:37:08 -07:00
parent 255ab8e9c9
commit 9196c9eef0
6 changed files with 23 additions and 7 deletions

View File

@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1123 );
define ( 'DB_UPDATE_VERSION', 1124 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -382,7 +382,7 @@ function notifier_run($argv, $argc){
$env_recips = (($private) ? array() : null);
$details = q("select xchan_hash, xchan_instance_url, xchan_addr, xchan_guid, xchan_guid_sig from xchan where xchan_hash in (" . implode(',',$recipients) . ")");
$details = q("select xchan_hash, xchan_instance_url, xchan_network, xchan_addr, xchan_guid, xchan_guid_sig from xchan where xchan_hash in (" . implode(',',$recipients) . ")");
$recip_list = array();

View File

@ -959,12 +959,13 @@ function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) {
);
}
logger('import_xchan: new hub: ' . $location['url']);
$r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_flags, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_updated, hubloc_connected)
values ( '%s','%s','%s','%s', %d ,'%s','%s','%s','%s','%s','%s','%s')",
$r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_network, hubloc_flags, hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey, hubloc_updated, hubloc_connected)
values ( '%s','%s','%s','%s', '%s', %d ,'%s','%s','%s','%s','%s','%s','%s')",
dbesc($arr['guid']),
dbesc($arr['guid_sig']),
dbesc($xchan_hash),
dbesc($location['address']),
dbesc('zot'),
intval((intval($location['primary'])) ? HUBLOC_FLAGS_PRIMARY : 0),
dbesc($location['url']),
dbesc($location['url_sig']),

View File

@ -442,6 +442,7 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
`hubloc_guid_sig` text NOT NULL,
`hubloc_hash` char(255) NOT NULL,
`hubloc_addr` char(255) NOT NULL DEFAULT '',
`hubloc_network` char(32) NOT NULL DEFAULT '',
`hubloc_flags` int(10) unsigned NOT NULL DEFAULT '0',
`hubloc_status` int(10) unsigned NOT NULL DEFAULT '0',
`hubloc_url` char(255) NOT NULL DEFAULT '',
@ -459,6 +460,7 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
KEY `hubloc_connect` (`hubloc_connect`),
KEY `hubloc_host` (`hubloc_host`),
KEY `hubloc_addr` (`hubloc_addr`),
KEY `hubloc_network` (`hubloc_network`),
KEY `hubloc_updated` (`hubloc_updated`),
KEY `hubloc_connected` (`hubloc_connected`),
KEY `hubloc_status` (`hubloc_status`)

View File

@ -1,6 +1,6 @@
<?php
define( 'UPDATE_VERSION' , 1123 );
define( 'UPDATE_VERSION' , 1124 );
/**
*
@ -1377,3 +1377,15 @@ function update_r1122() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
function update_r1123() {
$r1 = q("ALTER TABLE `hubloc` ADD `hubloc_network` CHAR( 32 ) NOT NULL DEFAULT '' AFTER `hubloc_addr` ,
ADD INDEX ( `hubloc_network` )");
$r2 = q("update hubloc set hubloc_network = 'zot' where true");
if($r1 && $r2)
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}

View File

@ -179,13 +179,14 @@ function import_post(&$a) {
// create new hubloc for the new channel at this site
$r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_flags,
$r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_hash, hubloc_addr, hubloc_network, hubloc_flags,
hubloc_url, hubloc_url_sig, hubloc_host, hubloc_callback, hubloc_sitekey )
values ( '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s' )",
values ( '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s' )",
dbesc($channel['channel_guid']),
dbesc($channel['channel_guid_sig']),
dbesc($channel['channel_hash']),
dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()),
dbesc('zot'),
intval(($seize) ? HUBLOC_FLAGS_PRIMARY : 0),
dbesc(z_root()),
dbesc(base64url_encode(rsa_sign(z_root(),$channel['channel_prvkey']))),