diff options
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/notifier.php | 2 | ||||
-rw-r--r-- | include/zot.php | 5 | ||||
-rw-r--r-- | install/database.sql | 2 | ||||
-rw-r--r-- | install/update.php | 14 | ||||
-rw-r--r-- | mod/import.php | 5 |
6 files changed, 23 insertions, 7 deletions
@@ -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' ); diff --git a/include/notifier.php b/include/notifier.php index 9d5c7cb8e..180a538bc 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -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(); diff --git a/include/zot.php b/include/zot.php index 41d0bc1eb..a155b2588 100644 --- a/include/zot.php +++ b/include/zot.php @@ -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']), diff --git a/install/database.sql b/install/database.sql index 2791f94be..104f145e5 100644 --- a/install/database.sql +++ b/install/database.sql @@ -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`) diff --git a/install/update.php b/install/update.php index f7d6441dc..9e184428e 100644 --- a/install/update.php +++ b/install/update.php @@ -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; +} + + diff --git a/mod/import.php b/mod/import.php index d3b237c3a..e732c3c06 100644 --- a/mod/import.php +++ b/mod/import.php @@ -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']))), |