[imp] migration problems from 2.2 to 3.0

Werner Reisberger werner@pure.ch
Sun, 10 Mar 2002 22:30:23 +0100


---------------------- multipart/mixed attachment
On Sun, Mar 10, 2002 at 07:28:13PM +0100, Jan Schneider wrote:
> > I modified the imp2horde.pl script to transfer all the data from imp_pref
> > to 
> > the corresponding rows in horde_prefs. The current script only fills a
> > row
> > named indentities. This results in the loss of the previous sig and
> > other
> > fields when opening the compose window the first time.
> > 
> > The imp2horde.pl and imp2turba.pl scripts are also changed for usage
> > with postgresql. I can provide these scripts by email.
> 
> Can you post diffs against the cvs versions so that we can include it in 
> the next release?

It's attached.

 Werner

---------------------- multipart/mixed attachment
22,25c23,26
<   my $location       = 'localhost';
<   my $port_num       = '5432';
<   my $username       = '';
<   my $password       = '';
---
>   our $location       = 'localhost';
>   our $port_num       = '3306';
>   our $username       = '';
>   our $password       = '';
27,31c28,33
<   my $IMP_DATABASE   = 'impdb';
<   my $IMP_TABLE      = 'imp_pref';
<   my $HORDE_DATABASE = 'horde';
<   my $HORDE_TABLE    = 'horde_prefs';
<   my $domain	      = 'your.com';
---
>   our $IMP_DATABASE   = 'horde';
>   our $IMP_TABLE      = 'imp_pref';
>   our $HORDE_DATABASE = 'horde2';
>   our $HORDE_TABLE    = 'horde_prefs';
>   our $domain	      = 'example.com';
>   our $identity_name  = 'Default Identity';
33c35
<   my $dbi_options = {RaiseError => 1, ChopBlanks => 1, AutoCommit => 1};
---
>   our $dbi_options = {RaiseError => 1, ChopBlanks => 1, AutoCommit => 1};
36,38c38,40
<                  ("DBI:Pg:dbname=$IMP_DATABASE;host=$location;port=$port_num",
<                    $username, $password, $dbi_options )
<                  || die ("Connection error: $DBI::errstr");
---
>                        ("DBI:mysql:$IMP_DATABASE:$location:$port_num",
>                          $username, $password, $dbi_options )
>                          || die ("Connection error: $DBI::errstr");
40,45c42,47
<   $db_horde =  DBI->connect
<                  ("DBI:Pg:dbname=$IMP_DATABASE;host=$location;port=$port_num",
<                    $username, $password, $dbi_options )
<                  || die ("Connection error: $DBI::errstr");
< 									     
<   $imp_statement = $db_imphandle->prepare("SELECT username,fullname,replyto,lang,sig FROM $IMP_TABLE");
---
>   $db_horde = DBI->connect
>                        ("DBI:mysql:$HORDE_DATABASE:$location:$port_num",
>                          $username, $password, $dbi_options )
>                          || die ("Connection error: $DBI::errstr");
> 								       
>   $imp_statement = $db_imphandle->prepare("SELECT * FROM $IMP_TABLE");
58,59d59
<     #print "$owner, $fullname, $replyto, $lang, $sig\n";
< 
69,70d68
<     my $quoted_sig = $db_imphandle->quote($sig);
<     my $quoted_lang = $db_imphandle->quote($lang);
72,73c70,71
<     my $value = "a:1:{i:0;a:12:{s:2:\"id\";s:19:\"$owner\";s:8:\"fullname\";s:".length($fullname).":\"$fullname\";s:9:\"from_addr\";s:0:\"\";s:12:\"replyto_addr\";s:".length($replyto).":\"$replyto\";s:9:\"signature\";s:".length($sig).":\"$sig\";s:9:\"sig_first\";i:0;s:10:\"sig_dashes\";s:1:\"1\";s:14:\"save_sent-mail\";N;s:16:\"sent_mail_folder\";s:15:\"INBOX.sent-mail\";s:14:\"save_sent_mail\";s:1:\"1\";s:11:\"private_key\";N;s:16:\"private_key_type\";N;}}";
<     my $quoted_value = $db_imphandle->quote($value);
---
>     my $value = "a:1:{i:0;a:9:{s:2:\"id\";s:".length($identity_name).":\"".$identity_name."\";s:8:\"fullname\";s:".length($fullname).":\"$fullname\";s:9:\"from_addr\";s:0:\"\";s:12:\"replyto_addr\";s:".length($replyto).":\"$replyto\";s:9:\"signature\";s:".length($sig).":\"$sig\";s:9:\"sig_first\";i:0;s:10:\"sig_dashes\";s:1:\"1\";s:16:\"sent_mail_folder\";s:15:\"INBOX.sent-mail\";s:14:\"save_sent_mail\";s:1:\"1\";}}";
>     my $quoted_value = $db_horde->quote($value);
81,111c79
<     # from_addr
<     $horde_statement = "INSERT INTO $HORDE_TABLE VALUES
<                         ($quoted_owner, 'horde', 'from_addr', $quoted_owner)";
<     $horde_statement = $db_horde->prepare($horde_statement)
<        || die "prepare: $$stmt: $DBI::errstr";
<     $horde_statement->execute || die "execute: $$stmt: $DBI::errstr";
<     # fullname
<     if ($fullname) {
<        $horde_statement = "INSERT INTO $HORDE_TABLE VALUES
<                            ($quoted_owner, 'horde', 'fullname', $quoted_fullname)";
<        $horde_statement = $db_horde->prepare($horde_statement)
<           || die "prepare: $$stmt: $DBI::errstr";
<        $horde_statement->execute || die "execute: $$stmt: $DBI::errstr";
<      }
<        # signature
<      if ($sig) {
<        $horde_statement = "INSERT INTO $HORDE_TABLE VALUES
<                            ($quoted_owner, 'horde', 'signature', $quoted_sig)";
<        $horde_statement = $db_horde->prepare($horde_statement)
<           || die "prepare: $$stmt: $DBI::errstr";
<        $horde_statement->execute || die "execute: $$stmt: $DBI::errstr";
<      }
<        # lang
<      if ($lang) {
<        $horde_statement = "INSERT INTO $HORDE_TABLE VALUES
<                            ($quoted_owner, 'horde', 'language', $quoted_lang)";
<        $horde_statement = $db_horde->prepare($horde_statement)
<           || die "prepare: $$stmt: $DBI::errstr";
<        $horde_statement->execute || die "execute: $$stmt: $DBI::errstr";
<      }
<        $horde_statement->finish();
---
>     $horde_statement->finish();

---------------------- multipart/mixed attachment
20,23c25,28
<   my $location       = 'localhost';
<   my $port_num       = '5432';
<   my $username       = '';
<   my $password       = '';
---
>   our $location       = 'localhost';
>   our $port_num       = '3306';
>   our $username       = '';
>   our $password       = '';
25,29c30,34
<   my $IMP_DATABASE   = 'impdb';
<   my $IMP_TABLE      = 'imp_addr';
<   my $TURBA_DATABASE = 'horde';
<   my $TURBA_TABLE    = 'turba_objects';
<   my $domain	      = 'your_domain';
---
>   our $IMP_DATABASE   = 'horde';
>   our $IMP_TABLE      = 'imp_addr';
>   our $TURBA_DATABASE = 'horde2';
>   our $TURBA_TABLE    = 'turba_objects';
>   our $domain	      = 'example.com';
31c36
<   my $dbi_options = {RaiseError => 1, ChopBlanks => 1, AutoCommit => 1};
---
>   our $dbi_options = {RaiseError => 1, ChopBlanks => 1, AutoCommit => 1};
34,36c39,41
<                  ("DBI:Pg:dbname=$IMP_DATABASE;host=$location;port=$port_num",
<                    $username, $password, $dbi_options )
<                    || die ("Connection error: $DBI::errstr");
---
>                        ("DBI:mysql:$IMP_DATABASE:$location:$port_num",
>                          $username, $password, $dbi_options )
>                          || die ("Connection error: $DBI::errstr");
39,41c44,46
<                  ("DBI:Pg:dbname=$IMP_DATABASE;host=$location;port=$port_num",
<                    $username, $password, $dbi_options )
<                    || die ("Connection error: $DBI::errstr");
---
>                        ("DBI:mysql:$TURBA_DATABASE:$location:$port_num",
>                          $username, $password, $dbi_options )
>                          || die ("Connection error: $DBI::errstr");

---------------------- multipart/mixed attachment--