From: Dirk Koopman Date: Sun, 26 Apr 2020 12:31:50 +0000 (+0100) Subject: fix export_users cmd X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=a460c345801374bfdccaf135ab1b03e5115f4266;p=spider.git fix export_users cmd Actually make sure that DXUser::del_file removes all versions of users.v3 it can find whether in /spider/data and in /spider/local_data. In the process make sure that the DEFAULT place that "localdata() places that is in /spider/local_data. --- diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 6a06bb3c..26eb3d42 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -177,9 +177,9 @@ sub init sub del_file { - my $fn = localdata("users"); - $fn .= $v3 ? ".v3" : ".v2"; - unlink $fn; + # with extreme prejudice + unlink "$main::data/users.v3"; + unlink "$main::local_data/users.v3"; } # @@ -488,12 +488,13 @@ while () { if ($ref) { $ref->put(); $count++; + DXUser::sync() unless $count % 10000; } else { print "# Error: $f[0]\t$f[1]\n"; $err++ } } -DXUser::sync; DXUser::finish; +DXUser::sync(); DXUser::finish(); print "There are $count user records and $err errors\n"; }; print $fh "__DATA__\n"; diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm index 28e7396d..4477a94b 100644 --- a/perl/DXUtil.pm +++ b/perl/DXUtil.pm @@ -472,16 +472,14 @@ sub deleteitem sub localdata { my $ifn = shift; - my $ofn = "$main::data/$ifn"; + my $ofn = "$main::local_data/$ifn"; my $tfn; if (-e "$main::local_data") { - $tfn = "$main::local_data/$ifn"; + $tfn = "$main::data/$ifn"; if (-e $tfn && -e $ofn) { - $ofn = $tfn if -M $tfn < -M $ofn; - } elsif (-e $tfn) { - $ofn = $tfn; - } + $ofn = $tfn if -M $ofn < -M $tfn; + } } return $ofn;