Skip to content
Snippets Groups Projects
Commit 47fb6dd3 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

updated POD sections

parent 0d61a777
Branches
No related tags found
No related merge requests found
@* @*
ts.* ts.*
typescript typescript
tmp/
...@@ -3,17 +3,17 @@ Perl script to sync individual projects to another Redmine instance. ...@@ -3,17 +3,17 @@ Perl script to sync individual projects to another Redmine instance.
Status Status
My current goal is to synchronize one isolated project, which only has My current goal is to synchronize one isolated project, which only
Wiki pages and attachments, from one instance to another. In the end, has Wiki pages and attachments, from one Redmine instance to another.
this project shall only be used on the destination instance. This is In the end, this project shall only be used on the destination instance.
more complicated that initially assumed but still leaves out the rather This is more complicated than initially assumed, but still leaves out
hairy problem of migrating issues or even issue numbers and whatever the rather hairy problem of migrating issues or even issue numbers and
embedded in Wiki text. whatever embedded in Wiki text.
Right now, synchronizing stuff that are related to users work. Right now, synchronizing stuff that are related to users work.
Wiki migration seems to work now too. 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 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 tool of choice for this problem. The script directly talks with
...@@ -26,3 +26,9 @@ NOTES ...@@ -26,3 +26,9 @@ NOTES
The project's entry in 'wikis' whould be added to syncs by hand The project's entry in 'wikis' whould be added to syncs by hand
since Redmine creates the Wiki but the script currently doesn't since Redmine creates the Wiki but the script currently doesn't
check for that, it only looks at the syncs table. 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
...@@ -9,7 +9,10 @@ use warnings; ...@@ -9,7 +9,10 @@ use warnings;
=head1 DESCRIPTION =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 =head1 OPERATION MODES
...@@ -31,10 +34,23 @@ use Redmine::DB::MySQL; ...@@ -31,10 +34,23 @@ use Redmine::DB::MySQL;
use Redmine::DB::CTX; use Redmine::DB::CTX;
# use Redmine::DB::Project; nothing here yet ... # use Redmine::DB::Project; nothing here yet ...
# yeah, this should be in a config file, but # --- BEGIN ------------------------------------------------------------
my $setup_file;
=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= my $setup=
{ {
'src' => 'src' =>
...@@ -48,10 +64,10 @@ my $setup= ...@@ -48,10 +64,10 @@ my $setup=
'db' => 'production', 'db' => 'production',
}, },
'sync_context_id' => 1, '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' => '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' => 'sync_projects' =>
[ [
...@@ -61,6 +77,7 @@ my $setup= ...@@ -61,6 +77,7 @@ my $setup=
} }
] ]
}; };
# --- END --------------------------------------------------------------
my @parameters= (); my @parameters= ();
my $op_mode= 'usage'; my $op_mode= 'usage';
...@@ -139,7 +156,6 @@ elsif ($op_mode eq 'user') ...@@ -139,7 +156,6 @@ elsif ($op_mode eq 'user')
my $user= $cfg->get_user ($an, $av); my $user= $cfg->get_user ($an, $av);
print "user: ", Dumper ($user); print "user: ", Dumper ($user);
} }
} }
elsif ($op_mode eq 'syncuser') elsif ($op_mode eq 'syncuser')
{ {
...@@ -176,7 +192,7 @@ elsif ($op_mode eq 'sync') ...@@ -176,7 +192,7 @@ elsif ($op_mode eq 'sync')
print "\n"x3, '='x72, "\n", "Statistics:", Dumper ($ctx->{'stats'}); 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 $src= read_configs($setup, 'src');
my $dst= read_configs($setup, 'dst'); my $dst= read_configs($setup, 'dst');
...@@ -192,7 +208,6 @@ elsif ($op_mode eq 'diag') ...@@ -192,7 +208,6 @@ elsif ($op_mode eq 'diag')
# my $src_members= $src->get_project_members (... some project id ...); # my $src_members= $src->get_project_members (... some project id ...);
# print "src_members: ", Dumper ($src_members); # print "src_members: ", Dumper ($src_members);
# print "src: ", Dumper ($src); # print "src: ", Dumper ($src);
} }
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment