diff --git a/.gitignore b/.gitignore index 6fe6835ede18db5d7352ae62aec35fa7656410ba..eed61d1983da685c6d8dd3b6b63209de1eb29325 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ @* ts.* typescript +tmp/ diff --git a/README.md b/README.md index 2771a657463bf51f31adc485eaf7980be9e37546..58eb6bf6e1a1a6a2702f11d80b66f0d702e475df 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,17 @@ Perl script to sync individual projects to another Redmine instance. Status -My current goal is to synchronize one isolated project, which only has -Wiki pages and attachments, from one instance to another. In the end, -this project shall only be used on the destination instance. This is -more complicated that initially assumed but still leaves out the rather -hairy problem of migrating issues or even issue numbers and whatever -embedded in Wiki text. +My current goal is to synchronize one isolated project, which only +has Wiki pages and attachments, from one Redmine instance to another. +In the end, this project shall only be used on the destination instance. +This is more complicated than initially assumed, but still leaves out +the rather hairy problem of migrating issues or even issue numbers and +whatever embedded in Wiki text. Right now, synchronizing stuff that are related to users work. Wiki migration seems to work now too. -The next step is are Wiki-Attachments. +The next step: Wiki-Attachments Why Perl? I'm not fluent enough in Ruby to even consider it as the tool of choice for this problem. The script directly talks with @@ -26,3 +26,9 @@ NOTES The project's entry in 'wikis' whould be added to syncs by hand since Redmine creates the Wiki but the script currently doesn't check for that, it only looks at the syncs table. + +TODOS + +* watchers: point to various content types, so only stuff + that is actually handled should be migrated here + diff --git a/t_sync.pl b/t_sync.pl index 86e882ff047cee4b570f5612bd84d30ee3cd120d..c9a049cef9cbea658751e64efdb39d1a05de60f0 100755 --- a/t_sync.pl +++ b/t_sync.pl @@ -9,7 +9,10 @@ use warnings; =head1 DESCRIPTION -do stuff on a Redmine database +Do stuff on a Redmine database. Used as an experimental sync-tool to +migrate individual projects to another server. + +See https://github.com/gonter/redmine-sync =head1 OPERATION MODES @@ -31,10 +34,23 @@ use Redmine::DB::MySQL; use Redmine::DB::CTX; # use Redmine::DB::Project; nothing here yet ... -# yeah, this should be in a config file, but -my $setup_file; +# --- BEGIN ------------------------------------------------------------ + +=begin comment + +Yeah, this should be in a config file, but this will do for now. + +This structure ($setup) resembles something like a "synchronisation +context". A "synchronisation context" needs to describe: + +* src: source Redmine instance +* dst: destination Redmine instance +* projects to be synced -# this structure ($setup) resembles something like a "context" +=end comment +=cut + +my $setup_file; my $setup= { 'src' => @@ -48,10 +64,10 @@ my $setup= 'db' => 'production', }, 'sync_context_id' => 1, - 'syncs' => + 'syncs' => # not used, instead, this is written directly into the database [ # { 'table' => 'projects', 'src_id' => 170, 'dst_id' => 1 } - { 'table' => 'auth_sources', 'src_id' => 1, 'dst_id' => 1, } + { 'table' => 'auth_sources', 'src_id' => 1, 'dst_id' => 1 } ], 'sync_projects' => [ @@ -61,6 +77,7 @@ my $setup= } ] }; +# --- END -------------------------------------------------------------- my @parameters= (); my $op_mode= 'usage'; @@ -139,7 +156,6 @@ elsif ($op_mode eq 'user') my $user= $cfg->get_user ($an, $av); print "user: ", Dumper ($user); } - } elsif ($op_mode eq 'syncuser') { @@ -176,7 +192,7 @@ elsif ($op_mode eq 'sync') print "\n"x3, '='x72, "\n", "Statistics:", Dumper ($ctx->{'stats'}); } -elsif ($op_mode eq 'diag') +elsif ($op_mode eq 'xxxdiag') { my $src= read_configs($setup, 'src'); my $dst= read_configs($setup, 'dst'); @@ -192,7 +208,6 @@ elsif ($op_mode eq 'diag') # my $src_members= $src->get_project_members (... some project id ...); # print "src_members: ", Dumper ($src_members); - # print "src: ", Dumper ($src); } else