Commit 2d003fcc authored by Leigh B. Stoller's avatar Leigh B. Stoller

Oops, need to check for existing experiments that do not have an

archive!
parent 6a0a1eb7
...@@ -881,8 +881,9 @@ sub TBExperimentArchiveInfo($$$$) ...@@ -881,8 +881,9 @@ sub TBExperimentArchiveInfo($$$$)
my ($archive_idx,$exptidx) = $query_result->fetchrow_array(); my ($archive_idx,$exptidx) = $query_result->fetchrow_array();
return -1 # Need to deal with no archive yet!
if (!defined($archive_idx)); return 1
if (!defined($archive_idx) || $archive_idx == 0);
$$idxp = $archive_idx $$idxp = $archive_idx
if (defined($idxp)); if (defined($idxp));
...@@ -949,8 +950,11 @@ sub TBExperimentArchiveAddFile($$$) ...@@ -949,8 +950,11 @@ sub TBExperimentArchiveAddFile($$$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
return ArchiveAdd($archive_idx, $pathname, $view); return ArchiveAdd($archive_idx, $pathname, $view);
} }
...@@ -966,8 +970,11 @@ sub TBExperimentArchiveSavePoint($$$) ...@@ -966,8 +970,11 @@ sub TBExperimentArchiveSavePoint($$$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
# #
# Derive a tag that contains some useful info? # Derive a tag that contains some useful info?
...@@ -991,8 +998,11 @@ sub TBExperimentArchivePreSwapMod($$) ...@@ -991,8 +998,11 @@ sub TBExperimentArchivePreSwapMod($$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
my $directory; my $directory;
if (GetArchiveDirectory($archive_idx, \$directory) < 0) { if (GetArchiveDirectory($archive_idx, \$directory) < 0) {
...@@ -1073,8 +1083,11 @@ sub TBExperimentArchiveRollBack($$) ...@@ -1073,8 +1083,11 @@ sub TBExperimentArchiveRollBack($$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
my $directory; my $directory;
if (GetArchiveDirectory($archive_idx, \$directory) < 0) { if (GetArchiveDirectory($archive_idx, \$directory) < 0) {
...@@ -1125,8 +1138,11 @@ sub TBExperimentArchiveSwapModCommit($$) ...@@ -1125,8 +1138,11 @@ sub TBExperimentArchiveSwapModCommit($$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
my $directory; my $directory;
if (GetArchiveDirectory($archive_idx, \$directory) < 0) { if (GetArchiveDirectory($archive_idx, \$directory) < 0) {
...@@ -1193,8 +1209,11 @@ sub TBCommitExperimentArchive($$$) ...@@ -1193,8 +1209,11 @@ sub TBCommitExperimentArchive($$$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
# #
# Need this below. # Need this below.
...@@ -1238,8 +1257,11 @@ sub TBArchiveExperimentArchive($$) ...@@ -1238,8 +1257,11 @@ sub TBArchiveExperimentArchive($$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
return ArchiveArchive($archive_idx, TBExptLogDir($pid, $eid)); return ArchiveArchive($archive_idx, TBExptLogDir($pid, $eid));
} }
...@@ -1256,8 +1278,11 @@ sub TBDeleteExperimentArchive($$) ...@@ -1256,8 +1278,11 @@ sub TBDeleteExperimentArchive($$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
return ArchiveDestroy($archive_idx, 0); return ArchiveDestroy($archive_idx, 0);
} }
...@@ -1273,8 +1298,11 @@ sub TBDestroyExperimentArchive($$) ...@@ -1273,8 +1298,11 @@ sub TBDestroyExperimentArchive($$)
return 0 return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID); if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view);
return 0
if ($rval > 0);
return -1 return -1
if (TBExperimentArchiveInfo($pid, $eid, \$archive_idx, \$view) < 0); if ($rval < 0);
return ArchiveDestroy($archive_idx, 1); return ArchiveDestroy($archive_idx, 1);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment