diff options
author | zotlabs <mike@macgirvin.com> | 2017-01-09 14:37:56 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-01-09 14:37:56 -0800 |
commit | a6272fcf769c3fc7c3834b3183dfbe25ec738550 (patch) | |
tree | b72e480213ace2bc47e5c252ef4ff0688c99ed14 /include | |
parent | 91e0733e8ef0640df20c18e91c61564458b091d1 (diff) | |
download | volse-hubzilla-a6272fcf769c3fc7c3834b3183dfbe25ec738550.tar.gz volse-hubzilla-a6272fcf769c3fc7c3834b3183dfbe25ec738550.tar.bz2 volse-hubzilla-a6272fcf769c3fc7c3834b3183dfbe25ec738550.zip |
channel move stuff (disabled currently because not yet complete)
Diffstat (limited to 'include')
-rw-r--r-- | include/import.php | 19 | ||||
-rw-r--r-- | include/zot.php | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/include/import.php b/include/import.php index e3d3e7e81..d19d056b3 100644 --- a/include/import.php +++ b/include/import.php @@ -155,7 +155,7 @@ function import_profiles($channel,$profiles) { } -function import_hublocs($channel,$hublocs,$seize) { +function import_hublocs($channel,$hublocs,$seize,$moving = false) { if($channel && $hublocs) { foreach($hublocs as $hubloc) { @@ -173,19 +173,32 @@ function import_hublocs($channel,$hublocs,$seize) { $hubloc['hubloc_deleted'] = (($hubloc['hubloc_flags'] & 0x1000) ? 1 : 0); } + if($moving && $hubloc['hubloc_hash'] === $channel['channel_hash'] && $hubloc['hubloc_url'] !== z_root()) { + $hubloc['hubloc_deleted'] = 1; + } + $arr = array( 'guid' => $hubloc['hubloc_guid'], 'guid_sig' => $hubloc['hubloc_guid_sig'], 'url' => $hubloc['hubloc_url'], - 'url_sig' => $hubloc['hubloc_url_sig'] + 'url_sig' => $hubloc['hubloc_url_sig'], + 'sitekey' => ((array_key_exists('hubloc_sitekey',$hubloc)) ? $hubloc['hubloc_sitekey'] : '') ); if(($hubloc['hubloc_hash'] === $channel['channel_hash']) && intval($hubloc['hubloc_primary']) && ($seize)) $hubloc['hubloc_primary'] = 0; - if(! zot_gethub($arr)) { + if(($x = zot_gethub($arr,false)) === false) { unset($hubloc['hubloc_id']); create_table_from_array('hubloc',$hubloc); } + else { + q("UPDATE hubloc set hubloc_primary = %d, hubloc_deleted = %d where hubloc_id = %d", + intval($hubloc['hubloc_primary']), + intval($hubloc['hubloc_deleted']), + intval($x['hubloc_id']) + ); + + } } } } diff --git a/include/zot.php b/include/zot.php index 96ec71112..c6d52816a 100644 --- a/include/zot.php +++ b/include/zot.php @@ -568,7 +568,7 @@ function zot_gethub($arr, $multiple = false) { } logger('zot_gethub: not found: ' . print_r($arr,true), LOGGER_DEBUG); - return null; + return false; } /** |