Igor Gariev (gariev) wrote in changelog,
Igor Gariev
gariev
changelog

[ljcom] r7166:

Committer: gariev

U   trunk/bin/upgrading/ipmap_text2binary.pl
Modified: trunk/bin/upgrading/ipmap_text2binary.pl
===================================================================
--- trunk/bin/upgrading/ipmap_text2binary.pl	2009-03-26 13:47:19 UTC (rev 7165)
+++ trunk/bin/upgrading/ipmap_text2binary.pl	2009-03-26 14:06:56 UTC (rev 7166)
@@ -4,10 +4,12 @@
 use warnings;
 use File::Temp qw/mktemp/;
 use IpMap;
+use lib "$ENV{LJHOME}/cgi-bin";
+BEGIN { require "ljlib.pl"; }
 
 my $ipmap = IpMap->new();
 
-if ($IpMap::VERSION le "1.1.0") {
+if ($IpMap::VERSION lt "1.1.0") {
     my $in_filename = "$ENV{LJHOME}/bin/upgrading/ipmap_cdn.txt";
     my $out_filename = "$ENV{LJHOME}/bin/upgrading/ipmap_cdn.bin";
     print "Reading IP database from '$in_filename'\n";
@@ -26,10 +28,10 @@
     system($cmd)==0 or die "Can't run mysql: $?";
     
     my $in_filename = "$ENV{LJHOME}/bin/upgrading/ipmap_lj.txt.gz";
-    my $tmp_filename = mktemp();
+    my $tmp_filename = mktemp("/tmp/ipmap_lj.txt.XXXXXX");
     my $out_filename = "$ENV{LJHOME}/bin/upgrading/ipmap_lj.bin";
 
-    print "Decompressing $in_filename into $tmp_filename";
+    print "Decompressing $in_filename into $tmp_filename\n";
     $cmd = "gzip -dc $in_filename > $tmp_filename";
     print $cmd, "\n";
     system($cmd)==0 or die "Can't run gzip: $?";
@@ -40,7 +42,7 @@
     $ipmap->SaveToBinary($out_filename);
     unlink($tmp_filename);
     
-    print "Renaming temp tables to permanent";
+    print "Renaming temp tables to permanent\n";
     rename_tables();
     print "Done.\n"
 }

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments