Commit aca4f452 authored by Leigh Stoller's avatar Leigh Stoller

Checkpoint changes to the Archive code.

* Add support for linking to the NS file that will be used, from the
  begin experiment page, when duplicating or branching an experiment.
  Ultimately we want to separate things so that user can first edit
  the NS file and then proceed to branching.

* In discussion we agreed to use the convention that a directory called
  "archive" in experiment directory, will always be saved and restored.
  This has been implemented.

* Add more of the support for branching an experiment (the archive).
  Batchexp takes a couple of new arguments:

	-c pid,eid[:tag]  or
	-c exptidx[:tag]

  The above specifies what and where to duplicate or branch. Simply
  giving pid,eid does not use the archive, but just copies right out
  of the existing experiment directory.

  Adding the -b option says to branch instead of duplicate.
parent b12b4f92
This diff is collapsed.
...@@ -47,7 +47,7 @@ my $SVNADMIN = "/usr/local/bin/svnadmin"; ...@@ -47,7 +47,7 @@ my $SVNADMIN = "/usr/local/bin/svnadmin";
my $IMPORTER = "$TB/sbin/svn_load_dirs.pl"; my $IMPORTER = "$TB/sbin/svn_load_dirs.pl";
my $inittag = 'root'; my $inittag = 'root';
my $defaultview = 'head'; my $defaultview = 'head';
my $debug = 0; my $debug = 2;
my $svnopt = ($debug ? "" : "-q"); my $svnopt = ($debug ? "" : "-q");
my %ROOTS = ("proj" => "proj", my %ROOTS = ("proj" => "proj",
"users" => "users", "users" => "users",
...@@ -197,8 +197,8 @@ sub ArchiveCreate(;$$$) ...@@ -197,8 +197,8 @@ sub ArchiveCreate(;$$$)
" date_created=UNIX_TIMESTAMP(now())") or goto bad; " date_created=UNIX_TIMESTAMP(now())") or goto bad;
# Now enter an initial tag for the tree. Nothing actually gets tagged. # Now enter an initial tag for the tree. Nothing actually gets tagged.
DBQueryWarn("insert into archive_tags set idx=NULL, view='$view', ". DBQueryWarn("insert into archive_tags set idx=NULL, ".
" tag='$tag', archive_idx='$idx', ". " tag='$tag', archive_idx='$idx', view='$view', ".
" date_created=UNIX_TIMESTAMP(now())") or goto bad; " date_created=UNIX_TIMESTAMP(now())") or goto bad;
return $idx; return $idx;
...@@ -400,7 +400,8 @@ sub ArchiveSavePoint($;$$$) ...@@ -400,7 +400,8 @@ sub ArchiveSavePoint($;$$$)
goto bad; goto bad;
} }
mysystem("$IMPORTER -no_user_input file://$repodir ". mysystem("$IMPORTER -no_user_input file://$repodir ".
" $view/savepoint . > /dev/null") " $view/savepoint . " .
($debug < 2 ? "> /dev/null" : ""))
== 0 or goto bad; == 0 or goto bad;
# #
...@@ -749,12 +750,24 @@ sub ArchiveFork($$;$$$) ...@@ -749,12 +750,24 @@ sub ArchiveFork($$;$$$)
" file://$repodir/$newview/trunk") " file://$repodir/$newview/trunk")
== 0 or goto bad; == 0 or goto bad;
# Do not want to copy the tags/savepoints directories. Add new ones. # Ditto for the savepoints directory.
mysystem("$SVN copy $svnopt -m 'ArchiveFork' ".
" file://$repodir/$view/savepoint ".
" file://$repodir/$newview/savepoint")
== 0 or goto bad;
# Do not want to copy the tags/history directories. Add new ones.
mysystem("$SVN mkdir $svnopt -m 'ArchiveFork' ". mysystem("$SVN mkdir $svnopt -m 'ArchiveFork' ".
" file://$repodir/$newview/savepoint ". " file://$repodir/$newview/history ".
" file://$repodir/$newview/tags") " file://$repodir/$newview/tags")
== 0 or goto bad; == 0 or goto bad;
# Create a branch tag in the tags directory to base differences against.
mysystem("$SVN copy $svnopt -m 'ArchiveFork Branch' ".
" file://$repodir/$newview/trunk ".
" file://$repodir/$newview/tags/${newtag}-branch")
== 0 or goto bad;
# Now check it out. This creates the checkouts/$newview directory. # Now check it out. This creates the checkouts/$newview directory.
mysystem("cd $checkouts; ". mysystem("cd $checkouts; ".
"$SVN checkout $svnopt file://$repodir/$newview") "$SVN checkout $svnopt file://$repodir/$newview")
...@@ -788,9 +801,9 @@ sub ArchiveFork($$;$$$) ...@@ -788,9 +801,9 @@ sub ArchiveFork($$;$$$)
# #
# Checkout a copy of the archive, optionally at a particular view/branch. # Checkout a copy of the archive, optionally at a particular view/branch.
# #
sub ArchiveCheckout($$;$$) sub ArchiveCheckout($$;$$$)
{ {
my ($archive_idx, $target, $view, $tag) = @_; my ($archive_idx, $target, $view, $tag, $subdir) = @_;
my $sourcepoint; my $sourcepoint;
my $cwd; my $cwd;
...@@ -849,6 +862,9 @@ sub ArchiveCheckout($$;$$) ...@@ -849,6 +862,9 @@ sub ArchiveCheckout($$;$$)
else { else {
$sourcepoint = "trunk" $sourcepoint = "trunk"
} }
# Allowed to check out a particular subdir (but not a file).
$sourcepoint = $sourcepoint . "/$subdir"
if (defined($subdir));
# Now check it out. This creates the $checkouts/$view directory. # Now check it out. This creates the $checkouts/$view directory.
mysystem("cd $target; ". mysystem("cd $target; ".
...@@ -951,9 +967,12 @@ sub ArchiveArchive($$) ...@@ -951,9 +967,12 @@ sub ArchiveArchive($$)
# Destroy an archive. The DB state is retained unless optional flag says # Destroy an archive. The DB state is retained unless optional flag says
# to clean it. # to clean it.
# #
sub ArchiveDestroy($$) sub ArchiveDestroy($$;$)
{ {
my ($archive_idx, $clean) = @_; my ($archive_idx, $clean, $view) = @_;
$view = $defaultview
if (!defined($view));
# #
# See if the archive exists and if it does, get the pathname to it. # See if the archive exists and if it does, get the pathname to it.
...@@ -984,19 +1003,31 @@ sub ArchiveDestroy($$) ...@@ -984,19 +1003,31 @@ sub ArchiveDestroy($$)
return 0; return 0;
} }
mysystem("/bin/rm -rf $directory"); # Is it shared? If so, certainly do not delete it!
if ($?) { my $shared;
print STDERR "ArchiveDestroy: ". if (IsArchiveShared($archive_idx, \$shared) < 0) {
"Could not remove contents of $directory!\n";
return -1; return -1;
} }
if (! $shared) {
mysystem("/bin/rm -rf $directory");
if ($?) {
print STDERR "ArchiveDestroy: ".
"Could not remove contents of $directory!\n";
return -1;
}
}
if ($clean) { if ($clean) {
(DBQueryWarn("delete from archive_tags ". (DBQueryWarn("delete from archive_tags ".
"where archive_idx='$archive_idx'") && "where archive_idx='$archive_idx' and view='$view'") &&
DBQueryWarn("delete from archive_views ". DBQueryWarn("delete from archive_views ".
"where archive_idx='$archive_idx'") && "where archive_idx='$archive_idx' and view='$view'"))
DBQueryWarn("delete from archives ". || return -1;
"where idx='$archive_idx'")) || return -1;
if (! $shared) {
DBQueryWarn("delete from archives ".
"where idx='$archive_idx'") || return -1;
}
} }
return 0; return 0;
} }
...@@ -1045,6 +1076,29 @@ sub IsArchiveArchived($$$) ...@@ -1045,6 +1076,29 @@ sub IsArchiveArchived($$$)
return 0; return 0;
} }
#
# See if the archive is shared amongst more then one experiment. This
# only looks at current experiments. Once an archive is archived, not
# sure what we will do if the user want to branch from it.
#
sub IsArchiveShared($$)
{
my ($idx, $prval) = @_;
my $query_result =
DBQueryWarn("select e.pid,e.eid,s.archive_idx from experiments as e ".
"left join experiment_stats as s on s.exptidx=e.idx ".
"where s.archive_idx='$idx'");
return -1
if (!$query_result || !$query_result->numrows);
$$prval = ($query_result->numrows > 1)
if (defined($prval));
return 0;
}
# #
# Get the current tag for an archive, given its index. Returns -1 on error, # Get the current tag for an archive, given its index. Returns -1 on error,
# zero otherwise. Place tag in the return pointer. # zero otherwise. Place tag in the return pointer.
...@@ -1141,11 +1195,12 @@ sub TBCreateExperimentArchive($$) ...@@ -1141,11 +1195,12 @@ sub TBCreateExperimentArchive($$)
if (!TBGroupUnixInfo($pid, $gid, \$unix_gid, \$unix_name)) { if (!TBGroupUnixInfo($pid, $gid, \$unix_gid, \$unix_name)) {
return -1; return -1;
} }
my $view = "$exptidx";
# #
# Create the new archive and get back the new index. # Create the new archive and get back the new index.
# #
my $archive_idx = ArchiveCreate($archive_tag, "$exptidx", $unix_name); my $archive_idx = ArchiveCreate($archive_tag, $view, $unix_name);
return -1 return -1
if ($archive_idx < 0); if ($archive_idx < 0);
...@@ -1156,13 +1211,13 @@ sub TBCreateExperimentArchive($$) ...@@ -1156,13 +1211,13 @@ sub TBCreateExperimentArchive($$)
DBQueryWarn("update experiment_resources set ". DBQueryWarn("update experiment_resources set ".
" archive_tag='$archive_tag' ". " archive_tag='$archive_tag' ".
"where idx='$rsrcidx'"))) { "where idx='$rsrcidx'"))) {
ArchiveDestroy($archive_idx, 1); ArchiveDestroy($archive_idx, 1, $view);
return -1; return -1;
} }
return 0; return 0;
bad: bad:
ArchiveDestroy($archive_idx, 1); ArchiveDestroy($archive_idx, 1, $view);
return -1; return -1;
} }
...@@ -1662,9 +1717,9 @@ sub TBCommitExperimentArchive($$$) ...@@ -1662,9 +1717,9 @@ sub TBCommitExperimentArchive($$$)
# #
# Checkout a copy of an experiment archive, optionally at a branch. # Checkout a copy of an experiment archive, optionally at a branch.
# #
sub TBCheckoutExperimentArchive($$$;$) sub TBCheckoutExperimentArchive($$$;$$)
{ {
my ($pid, $eid, $path, $tag) = @_; my ($pid, $eid, $path, $tag, $subdir) = @_;
my ($archive_idx, $view); my ($archive_idx, $view);
return 0 return 0
...@@ -1676,15 +1731,15 @@ sub TBCheckoutExperimentArchive($$$;$) ...@@ -1676,15 +1731,15 @@ sub TBCheckoutExperimentArchive($$$;$)
return -1 return -1
if ($rval < 0); if ($rval < 0);
return ArchiveCheckout($archive_idx, $path, $view, $tag); return ArchiveCheckout($archive_idx, $path, $view, $tag, $subdir);
} }
# #
# Checkout a copy of an experiment archive, optionally at a branch. # Checkout a copy of an experiment archive, optionally at a branch.
# #
sub TBCheckoutExperimentArchivebyExptIDX($$;$) sub TBCheckoutExperimentArchivebyExptIDX($$;$$)
{ {
my ($exptidx, $path, $tag) = @_; my ($exptidx, $path, $tag, $subdir) = @_;
return 0 return 0
if (!$MAINSITE); if (!$MAINSITE);
...@@ -1705,7 +1760,7 @@ sub TBCheckoutExperimentArchivebyExptIDX($$;$) ...@@ -1705,7 +1760,7 @@ sub TBCheckoutExperimentArchivebyExptIDX($$;$)
return 1 return 1
if (!defined($archive_idx) || $archive_idx == 0); if (!defined($archive_idx) || $archive_idx == 0);
return ArchiveCheckout($archive_idx, $path, $exptidx, $tag); return ArchiveCheckout($archive_idx, $path, $exptidx, $tag, $subdir);
} }
# #
...@@ -1746,7 +1801,7 @@ sub TBDeleteExperimentArchive($$) ...@@ -1746,7 +1801,7 @@ sub TBDeleteExperimentArchive($$)
return -1 return -1
if ($rval < 0); if ($rval < 0);
return ArchiveDestroy($archive_idx, 0); return ArchiveDestroy($archive_idx, 0, $view);
} }
# #
...@@ -1766,7 +1821,56 @@ sub TBDestroyExperimentArchive($$) ...@@ -1766,7 +1821,56 @@ sub TBDestroyExperimentArchive($$)
return -1 return -1
if ($rval < 0); if ($rval < 0);
return ArchiveDestroy($archive_idx, 1); return ArchiveDestroy($archive_idx, 1, $view);
}
#
# Branch an experiment archive. Only an existing experiment can be
# branched, but that will probably change later.
#
sub TBForkExperimentArchive($$$$$)
{
my ($pid, $eid, $copypid, $copyeid, $copytag) = @_;
my ($archive_idx, $copyview);
return 0
if (!$MAINSITE || $pid ne $ALLOWEDPID);
my $rval = TBExperimentArchiveInfo($copypid, $copyeid,
\$archive_idx, \$copyview);
return 0
if ($rval > 0);
return -1
if ($rval < 0);
# Grab experiment indicies we need,
my $query_result =
DBQueryWarn("select e.idx,s.rsrcidx from experiments as e ".
"left join experiment_stats as s on e.idx=s.exptidx ".
"where e.pid='$pid' and e.eid='$eid'");
if (!$query_result || !$query_result->numrows) {
return -1;
}
my ($exptidx,$rsrcidx) = $query_result->fetchrow_array();
my $archive_tag = "T${rsrcidx}";
my $newview = "$exptidx";
return -1
if (ArchiveFork($archive_idx, $newview,
$copytag, $archive_tag, $copyview) < 0);
if (! (DBQueryWarn("update experiment_stats set ".
" archive_idx='$archive_idx' ".
"where pid='$pid' and eid='$eid' and ".
" exptidx='$exptidx'") &&
DBQueryWarn("update experiment_resources set ".
" archive_tag='$archive_tag' ".
"where idx='$rsrcidx'"))) {
# Its a shared resource, but ArchiveDestroy() checks.
ArchiveDestroy($archive_idx, 1, $newview);
return -1;
}
return 0;
} }
# _Always_ make sure that this 1 is at the end of the file... # _Always_ make sure that this 1 is at the end of the file...
......
...@@ -56,7 +56,7 @@ $exptidx = TBExptIndex($pid, $eid); ...@@ -56,7 +56,7 @@ $exptidx = TBExptIndex($pid, $eid);
if ($exptidx < 0) { if ($exptidx < 0) {
TBERROR("Could not get experiment index for $pid/$eid!", 1); TBERROR("Could not get experiment index for $pid/$eid!", 1);
} }
$url = "cvsweb/cvsweb.php3?exptidx=$exptidx"; $url = "cvsweb/cvsweb.php3/${exptidx}?exptidx=$exptidx";
echo "<center>\n"; echo "<center>\n";
echo "This is the Subversion archive for your experiment.<br>"; echo "This is the Subversion archive for your experiment.<br>";
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group. # Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -24,7 +24,7 @@ function INITFORM($formfields, $projlist) ...@@ -24,7 +24,7 @@ function INITFORM($formfields, $projlist)
# #
# See what kind of copy. # See what kind of copy.
# #
if (preg_match("/^(\d+)((?::[-\w]*)?)$/", $copyid, $matches)) { if (preg_match("/^(\d+)(?::([-\w]*))?$/", $copyid, $matches)) {
$exptidx = $matches[1]; $exptidx = $matches[1];
if (TBvalid_integer($exptidx)) { if (TBvalid_integer($exptidx)) {
...@@ -43,7 +43,7 @@ function INITFORM($formfields, $projlist) ...@@ -43,7 +43,7 @@ function INITFORM($formfields, $projlist)
} }
} }
} }
elseif (preg_match("/^([-\w]+),([-\w]+)((?::[-\w]*)?)$/", elseif (preg_match("/^([-\w]+),([-\w]+)(?::([-\w]*))?$/",
$copyid, $matches)) { $copyid, $matches)) {
$copypid = $matches[1]; $copypid = $matches[1];
$copyeid = $matches[2]; $copyeid = $matches[2];
...@@ -208,7 +208,7 @@ function SPITFORM($formfields, $errors) ...@@ -208,7 +208,7 @@ function SPITFORM($formfields, $errors)
{ {
global $TBDB_PIDLEN, $TBDB_GIDLEN, $TBDB_EIDLEN, $TBDOCBASE; global $TBDB_PIDLEN, $TBDB_GIDLEN, $TBDB_EIDLEN, $TBDOCBASE;
global $view, $view_style, $projlist, $linktest_levels; global $view, $view_style, $projlist, $linktest_levels;
global $EXPOSELINKTEST; global $EXPOSELINKTEST, $EXPOSEARCHIVE;
global $EXPOSESTATESAVE; global $EXPOSESTATESAVE;
PAGEHEADER("Begin a Testbed Experiment"); PAGEHEADER("Begin a Testbed Experiment");
...@@ -427,7 +427,21 @@ function SPITFORM($formfields, $errors) ...@@ -427,7 +427,21 @@ function SPITFORM($formfields, $errors)
echo "<tr> echo "<tr>
<td class='pad4'>Copy of experiment: &nbsp</td> <td class='pad4'>Copy of experiment: &nbsp</td>
<td class='pad4'>$copyid</td> <td class='pad4'>
<a target=nsfile href=spitnsdata.php3?copyid=$copyid>
$copyid</a>\n";
if ($EXPOSEARCHIVE) {
$checked = "";
if ($formfields[exp_branch] == "1") {
$checked = "checked=1";
}
echo "&nbsp <input type='checkbox' $checked
name='formfields[exp_branch]' value='1'> ";
echo "&nbsp Branch?";
}
echo " </td>
<input type=hidden name=\"formfields[copyid]\" value='$copyid'> <input type=hidden name=\"formfields[copyid]\" value='$copyid'>
</tr>\n"; </tr>\n";
} }
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group. # Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -307,6 +307,11 @@ if (! TBProjAccessCheck($uid, $exp_pid, $exp_gid, $TB_PROJECT_CREATEEXPT)) { ...@@ -307,6 +307,11 @@ if (! TBProjAccessCheck($uid, $exp_pid, $exp_gid, $TB_PROJECT_CREATEEXPT)) {
# #
if ($nsfilelocale == "copyid") { if ($nsfilelocale == "copyid") {
$thensfile = "-c " . $formfields['copyid']; $thensfile = "-c " . $formfields['copyid'];
# A branch needs the -b option.
if (isset($formfields[exp_branch]) && $formfields[exp_branch] == "1") {
$thensfile = $thensfile . " -b ";
}
} }
elseif ($nsfilelocale == "local") { elseif ($nsfilelocale == "local") {
# #
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group. # Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -241,8 +241,7 @@ while ($row = mysql_fetch_assoc($query_result)) { ...@@ -241,8 +241,7 @@ while ($row = mysql_fetch_assoc($query_result)) {
echo "<td>$idx</td>"; echo "<td>$idx</td>";
if ($EXPOSEARCHIVE) { if ($EXPOSEARCHIVE) {
if ($archive_idx && $archive_tag && if ($archive_idx && $archive_tag &&
(strcmp($action, "swapout") == 0 || ($action == "swapout" || $action == "swapmod")) {
strcmp($action, "swapmod") == 0)) {
echo " <td align=center> echo " <td align=center>
<a href=beginexp_html.php3?copyid=$exptidx:$archive_tag> <a href=beginexp_html.php3?copyid=$exptidx:$archive_tag>
<img border=0 alt=Run src=greenball.gif></a></td>"; <img border=0 alt=Run src=greenball.gif></a></td>";
......
...@@ -715,10 +715,12 @@ function SHOWEXP($pid, $eid, $short = 0, $sortby = "") { ...@@ -715,10 +715,12 @@ function SHOWEXP($pid, $eid, $short = 0, $sortby = "") {
} }
$query_result = $query_result =
DBQueryFatal("select e.*, pl.slicename, ". DBQueryFatal("select e.*, s.archive_idx, pl.slicename, ".
"round(e.minimum_nodes+.1,0) as min_nodes, ". "round(e.minimum_nodes+.1,0) as min_nodes, ".
"round(e.maximum_nodes+.1,0) as max_nodes ". "round(e.maximum_nodes+.1,0) as max_nodes ".
" from experiments as e left join plab_slices as pl". " from experiments as e ".
"left join experiment_stats as s on s.exptidx=e.idx ".
"left join plab_slices as pl".
" on e.pid = pl.pid and e.eid = pl.eid ". " on e.pid = pl.pid and e.eid = pl.eid ".
"where e.pid='$pid' and e.eid='$eid'"); "where e.pid='$pid' and e.eid='$eid'");
...@@ -765,6 +767,7 @@ function SHOWEXP($pid, $eid, $short = 0, $sortby = "") { ...@@ -765,6 +767,7 @@ function SHOWEXP($pid, $eid, $short = 0, $sortby = "") {
$mnet_edges = $exprow["modelnet_edges"]; $mnet_edges = $exprow["modelnet_edges"];
$lockdown = $exprow["lockdown"]; $lockdown = $exprow["lockdown"];
$exptidx = $exprow["idx"]; $exptidx = $exprow["idx"];
$archive_idx = $exprow["archive_idx"];
$autoswap_hrs= ($autoswap_timeout/60.0); $autoswap_hrs= ($autoswap_timeout/60.0);
$idleswap_hrs= ($idleswap_timeout/60.0); $idleswap_hrs= ($idleswap_timeout/60.0);
...@@ -1037,7 +1040,10 @@ function SHOWEXP($pid, $eid, $short = 0, $sortby = "") { ...@@ -1037,7 +1040,10 @@ function SHOWEXP($pid, $eid, $short = 0, $sortby = "") {
} }
echo "<tr> echo "<tr>
<td>Index: </td> <td>Index: </td>
<td class=\"left\">$exptidx</td> <td class=\"left\">$exptidx";
if ($archive_idx)
echo " ($archive_idx) ";
echo " </td>
</tr>\n"; </tr>\n";
} }
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2005 University of Utah and the Flux Group. # Copyright (c) 2000-2003, 2005-2006 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -12,6 +12,88 @@ include("defs.php3"); ...@@ -12,6 +12,88 @@ include("defs.php3");
$uid = GETLOGIN(); $uid = GETLOGIN();
LOGGEDINORDIE($uid); LOGGEDINORDIE($uid);
#
# This comes from the begin_experiment page, when cloning an experiment
# from another experiment.
#
if (isset($copyid) && $copyid != "") {
unset($exptidx);
unset($copypid);
unset($copyeid);
unset($copytag);
#
# See what kind of copyid.
#
if (preg_match("/^(\d+)(?::([-\w]*))?$/", $copyid, $matches)) {
$exptidx = $matches[1];
$copytag = $matches[2];
if (TBvalid_integer($exptidx)) {
#
# See if its a current experiment.
#
$query_result =
DBQueryFatal("select pid,eid from experiments ".
"where idx='$exptidx'");
if (mysql_num_rows($query_result)) {
$row = mysql_fetch_row($query_result);
$copypid = $row[0];
$copyeid = $row[1];
}
}
}
elseif (preg_match("/^([-\w]+),([-\w]+)(?::([-\w]*))?$/",
$copyid, $matches)) {
$copypid = $matches[1];
$copyeid = $matches[2];
$copytag = $matches[3];
}
else {
PAGEARGERROR("Invalid ID");
}
if (isset($copypid) && isset($copyeid) &&
(!isset($copytag) || $copytag == "")) {
$pid = $copypid;
$eid = $copyeid;
# Fall through to below.
}
elseif (isset($exptidx)) {
#
# By convention, this means to always go to the archive. There
# must be a tag.
#
if (! isset($copytag) || $copytag == "") {
PAGEARGERROR("Must supply a tag");
}
if (! isset($copypid)) {
#
# Ick, map to pid,eid so we can generate a proper path into
# the archive. This is bad.
#
$query_result =
DBQueryFatal("select pid,eid from experiments_stats ".
"where exptidx='$exptidx'");
if (!mysql_num_rows($query_result)) {
PAGEARGERROR("Invalid experiment index!", 1);
}
$row = mysql_fetch_row($query_result);
$copypid = $row[0];
$copyeid = $row[1];
}
header("Location: cvsweb/cvsweb.php3/$exptidx/tags/$copytag/".
"proj/$copypid/exp/$copyeid/${copyeid}.ns?".
"exptidx=$exptidx&view=markup");
}
else {
PAGEARGERROR("");
}
}
# #
# Spit back an NS file to the user. # Spit back an NS file to the user.
# #
......
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