belt and braces locate users.v4 in DXUser.pm
[spider.git] / perl / DXUser.pm
index d9c166009ff6a7c28d7246bc62b76e92f6e5cb58..5e8f2dfab50abfb600c7fe128881e892a09b44cb 100644 (file)
@@ -197,7 +197,7 @@ sub init
                $v4 = 1;
                readinjson();
        } else {
-               die "User file $filename missing, please run users-v3-to-v4.pl or copy a user_json backup from somewhere\n";
+               die "User file $filename missing, please run convert-users-v3-to-v4.pl or copy a user_json backup from somewhere\n";
        }
 }
 
@@ -897,10 +897,13 @@ sub readinjson
                move($nfn, $fn);
        };
 
-       # if we don't have a users.v4 at this point, look for a backup users.v4.o
+       # if we don't have a users.v4 at this point, look for a backup users.v4.json, users.v4.n then users.v4.o
        unless (-e $fn) {
-               move($ofn, $fn);
+               move($nfn, $fn) unless -e $fn;  # the users.v4 isn't there (maybe convert-users-v3-to-v4.pl
+               move("$fn.json", $fn);                  # from a run of convert-users-v3-to-v4.pl
+               move($ofn, $fn) unless -e $fn;  # desperate now...
        }
+       
        if ($ifh) {
                $ifh->seek(0, 0);
        } else {