- my %oldu;
- LogDbg('',"Converting the User File from V$convert to $fn.v4 ");
- LogDbg('',"This will take a while, I suggest you go and have cup of strong tea");
- my $odbm = tie (%oldu, 'DB_File', localdata("users.v$convert"), O_RDONLY, 0666, $DB_BTREE) or confess "can't open user file: $fn.v$convert ($!) [rebuild it from user_asc?]";
- for ($action = R_FIRST; !$odbm->seq($key, $val, $action); $action = R_NEXT) {
- my $ref;
- if ($convert == 3) {
- eval { $ref = storable_decode($val) };
- } else {
- eval { $ref = asc_decode($val) };
- }
- unless ($@) {
- if ($ref) {
- $u{$key} = $ref;
- $count++;
- } else {
- $err++
- }
- } else {
- Log('err', "DXUser: error decoding $@");
- }
- }
- undef $odbm;
- untie %oldu;
- my $t = _diffms($ta);
- LogDbg('',"Conversion from users.v$convert to users.v4 completed $count records $err errors $t mS");
-
- # now write it away for future use
- $ta = [gettimeofday];
- $err = 0;
- $count = writeoutjson();
- $t = _diffms($ta);
- LogDbg('',"New Userfile users.v4 write completed $count records $err errors $t mS");
- LogDbg('',"Now restarting..");
- $main::ending = 10;
- } else {
- # otherwise (i.e normally) slurp it in
- readinjson();