[rt-devel] rt dump in reverse order (rt2-to-rt3)

mixo mixo at coza.net.za
Wed Dec 3 05:14:10 EST 2003


Phil Homewood wrote:

>mixo wrote:
>  
>
>>I have a situation where a dump of about 90K tickets takes ~ 5 days to 
>>import.
>>    
>>
>
>So, you should look at the import tool's "incremental" mode.
>
I have seen "incremental" mode, but I am interested in doing the ticket 
import in reverse
and I might use the mode along with reverse ticket import.

Right now I am testing a modified version of the rt2-to-rt3 (1.20) 
import scripts that starts
with the last ticket, and finishes with first. The reason for this is to 
get the most recent
tickets into RT first, which might (or might not) help make the 
transition to rt3 easier
provided it works.
-------------- next part --------------
--- dumpfile-to-rt-3.0	2003-08-07 07:51:03.000000000 +0200
+++ dumpfile-to-rt-3.0-reverse	2003-12-03 11:43:15.000000000 +0200
@@ -31,7 +31,7 @@
 my $import_queues          = 1;
 my $import_tickets         = 1;
 my $import_links           = 1;
-use lib ("/opt/bestpractical.com-rt3/lib");
+use lib ("/opt/rt3-my-2/lib");
 
 use Getopt::Long;
 
@@ -477,10 +477,18 @@
     eval "sub Data {die 'Ticket files could not be loaded'}";
     print "Importing tickets";
     opendir( TOPDIR, $DIR ) || die "Couldn't open $DIR";
-    while ( my $subdir = readdir(TOPDIR) ) {
+    my @subdiris = readdir(TOPDIR)  ;
+    @subdiris = sort @subdiris;
+    @subdiris = reverse @subdiris;
+    foreach my $subdir (@subdiris)  {
+    #while ( my $subdir = readdir(TOPDIR) ) {
         next unless ( $subdir =~ /^tickets-/i );
         opendir( DIR, $DIR . "/" . $subdir ) || die "Couldn't open $subdir";
-        while ( my $file = readdir(DIR) ) {
+        my @files = readdir(DIR);
+        @files = sort @files;
+        @files = reverse @files;
+        foreach  my $file (@files)  {
+        #while ( my $file = readdir(DIR) ) {
             print ".";
             next unless ( $file =~ /^t-(\d+)$/ );
             print $file . "\n";


More information about the Rt-devel mailing list