aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-01-09 14:37:56 -0800
committerzotlabs <mike@macgirvin.com>2017-01-09 14:37:56 -0800
commita6272fcf769c3fc7c3834b3183dfbe25ec738550 (patch)
treeb72e480213ace2bc47e5c252ef4ff0688c99ed14
parent91e0733e8ef0640df20c18e91c61564458b091d1 (diff)
downloadvolse-hubzilla-a6272fcf769c3fc7c3834b3183dfbe25ec738550.tar.gz
volse-hubzilla-a6272fcf769c3fc7c3834b3183dfbe25ec738550.tar.bz2
volse-hubzilla-a6272fcf769c3fc7c3834b3183dfbe25ec738550.zip
channel move stuff (disabled currently because not yet complete)
-rw-r--r--Zotlabs/Module/Import.php9
-rw-r--r--doc/roadmap_hz3.md6
-rw-r--r--include/import.php19
-rw-r--r--include/zot.php2
-rwxr-xr-xview/tpl/channel_import.tpl6
5 files changed, 34 insertions, 8 deletions
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index 451effaca..aa79fa8bf 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -118,7 +118,7 @@ class Import extends \Zotlabs\Web\Controller {
return;
}
- $moving = false;
+ $moving = intval($_REQUEST['moving']);
if(array_key_exists('compatibility',$data) && array_key_exists('database',$data['compatibility'])) {
$v1 = substr($data['compatibility']['database'],-4);
@@ -196,8 +196,8 @@ class Import extends \Zotlabs\Web\Controller {
if($completed < 4) {
- if(is_array($data['hubloc']) && (! $moving)) {
- import_hublocs($channel,$data['hubloc'],$seize);
+ if(is_array($data['hubloc'])) {
+ import_hublocs($channel,$data['hubloc'],$seize,$moving);
}
logger('import step 4');
@@ -536,6 +536,9 @@ class Import extends \Zotlabs\Web\Controller {
'$label_old_pass' => t('Your old login password'),
'$common' => t('For either option, please choose whether to make this hub your new primary address, or whether your old location should continue this role. You will be able to post from either location, but only one can be marked as the primary location for files, photos, and media.'),
'$label_import_primary' => t('Make this hub my primary location'),
+ '$allow_move' => 0,
+ '$label_import_moving' => t('Move this channel (disable all previous locations)'),
+
'$label_import_posts' => t('Import existing posts if possible (experimental - limited by available memory'),
'$pleasewait' => t('This process may take several minutes to complete. Please submit the form only once and leave this page open until finished.'),
'$email' => '',
diff --git a/doc/roadmap_hz3.md b/doc/roadmap_hz3.md
index 9f24cf1f2..a64fb2d5c 100644
--- a/doc/roadmap_hz3.md
+++ b/doc/roadmap_hz3.md
@@ -20,4 +20,8 @@ Wishlist:
- issues manager
-- wiki cloning \ No newline at end of file
+- wiki cloning
+
+- provide easy channel move (as opposed to channel copy or clone), which is currently supported only by the basic server role.
+
+- provide RSA keychange operation; which cannot affect the primary identity (which is based on the channel keys), so add a secondary dynamic key pair which will be used for all other operations and can be upgraded or revoked at any time. \ No newline at end of file
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;
}
/**
diff --git a/view/tpl/channel_import.tpl b/view/tpl/channel_import.tpl
index 6974e4d30..0260bf778 100755
--- a/view/tpl/channel_import.tpl
+++ b/view/tpl/channel_import.tpl
@@ -33,6 +33,12 @@
<label for="import-make-primary" id="label-import-make-primary">{{$label_import_primary}}</label>
<div id="import-make-primary-end" class="import-field-end"></div>
+ {{if $allow_move}}
+ <input type="checkbox" name="moving" id="import-moving" value="1" />
+ <label for="import-moving" id="label-import-moving">{{$label_import_moving}}</label>
+ <div id="import-moving-end" class="import-field-end"></div>
+ {{/if}}
+
<input type="submit" name="submit" id="import-submit-button" value="{{$submit}}" />
<div id="import-submit-end" class="import-field-end"></div>