diff --git a/tbsetup/archive_control.in b/tbsetup/archive_control.in index 105d469bac9118d52896da28f816a3bf729421ae..85698dfd7566da46c48dbb589c65f63b031bc9ba 100755 --- a/tbsetup/archive_control.in +++ b/tbsetup/archive_control.in @@ -72,7 +72,7 @@ if (@ARGV < 3) { usage(); } if (defined($options{"d"})) { - $debug = 1; + $debug = 2; } if (defined($options{"f"})) { $force = 1; @@ -115,17 +115,8 @@ if (! TBExptAccessCheck($UID, $pid, $eid, TB_EXPT_UPDATE)) { fatal("You do not have permission to control the archive for $pid/$eid!"); } -# -# Do not allow an archive system to be controlled if the experiment is not -# active or swapped. Will probably be changed later. -# -if ($expstate ne EXPTSTATE_ACTIVE && - $expstate ne EXPTSTATE_SWAPPED) { - fatal("Experiment $pid/$eid must be active or swapped!"); -} - # Temporary -libArchive::setdebug(2); +libArchive::setdebug($debug); # Do not audit this operation. if ($action eq "checktag") { @@ -146,6 +137,15 @@ if ($action eq "checktag") { exit(($unique ? 0 : 1)); } +# +# Do not allow an archive system to be controlled if the experiment is not +# active or swapped. Will probably be changed later. +# +if ($expstate ne EXPTSTATE_ACTIVE && + $expstate ne EXPTSTATE_SWAPPED) { + fatal("Experiment $pid/$eid must be active or swapped!"); +} + # # Allow the user to force a commit of the archive. # @@ -187,7 +187,7 @@ if ($action eq "commit") { } } - if ($NFSTRACESUPPORT) { + if (0 && $NFSTRACESUPPORT) { # # This program asks the nodes for the trace results. # @@ -357,6 +357,8 @@ elsif ($action eq "list" || "LEFT JOIN accessed_files as af on af.idx=fr.fileidx ". "WHERE fr.rsrcidx=$rsrcidx and fr.type!='l'"); while (my ($fn) = $query_result->fetchrow_array()) { + #print "Accessed: $fn\n"; + if ($fn =~ /^\/share/ || $fn =~ /\/tbdata\// || $fn =~ /^

"; echo "\n"; - echo "\n"; echo "\n"; diff --git a/www/archive_tag.php3 b/www/archive_tag.php3 index 6f50cd1e4903bbb07c5fe9e2d5017e099e540330..2271fbc9a1a98923b050311af0e923f2591cee15 100644 --- a/www/archive_tag.php3 +++ b/www/archive_tag.php3 @@ -16,30 +16,42 @@ $isadmin = ISADMIN($uid); # # Verify page arguments. -# -if (!isset($pid) || - strcmp($pid, "") == 0) { - USERERROR("You must provide a Project ID.", 1); +# +if (! isset($exptidx) || $exptidx == "") { + USERERROR("Must supply an experiment to view!", 1); } -if (!isset($eid) || - strcmp($eid, "") == 0) { - USERERROR("You must provide an Experiment ID.", 1); +if (!TBvalid_integer($exptidx)) { + USERERROR("Invalid characters in $exptidx!", 1); } -if (!TBvalid_pid($pid)) { - PAGEARGERROR("Invalid project ID."); + +# +# We get an index. Must map that to a pid/gid to do a group level permission +# check, since it might not be an current experiment. +# +unset($pid); +unset($eid); +unset($gid); +if (TBExptidx2PidEid($exptidx, $pid, $eid, $gid) < 0) { + USERERROR("No such experiment index $exptidx!", 1); } -if (!TBvalid_eid($eid)) { - PAGEARGERROR("Invalid experiment ID."); + +if (!$isadmin && + !TBProjAccessCheck($uid, $pid, $gid, $TB_PROJECT_READINFO)) { + USERERROR("You do not have permission to view tags for ". + "archive in $pid/$gid ($exptidx)!", 1); +} +if (!TBCurrentExperiment($exptidx)) { + USERERROR("Experiment index $exptidx is not a current experiment!", 1); } function SPITFORM($formfields, $errors) { - global $isadmin, $pid, $eid, $TBDB_ARCHIVE_TAGLEN; + global $isadmin, $exptidx, $TBDB_ARCHIVE_TAGLEN; # # Standard Testbed Header # - PAGEHEADER("Commit/Tag archive for experiment $pid/$eid"); + PAGEHEADER("Commit/Tag archive for experiment $exptidx"); echo "
Commit/Tag Archive @@ -68,7 +80,7 @@ function SPITFORM($formfields, $errors) } echo "
- \n"; + \n"; echo "
@@ -196,10 +208,6 @@ if (count($errors)) { return; } -if (!TBExptGroup($pid, $eid, $gid)) { - TBERROR("Could not get experiment gid for $pid/$eid!", 1); -} - # # First lets make sure the tag is unique. # @@ -226,5 +234,5 @@ SUEXEC($uid, "$pid,$gid", "webarchive_control $tagarg $message commit $pid $eid", SUEXEC_ACTION_DIE); -header("Location: archive_view.php3?pid=$pid&eid=$eid"); +header("Location: archive_view.php3/$exptidx/?exptidx=$exptidx"); ?> diff --git a/www/archive_tags.php3 b/www/archive_tags.php3 index 730febd5cf13bd3623cf421494d460ff5b0b8be1..9727e59c99b3e5e5f06aa42a4ed4ecfab9a997e5 100644 --- a/www/archive_tags.php3 +++ b/www/archive_tags.php3 @@ -24,53 +24,58 @@ if (!isset($records) || !strcmp($records, "")) { $records = 100; } -if (! isset($which) || $which == "") { - USERERROR("Must supply an experiment to view!", 1); +# An experiment idx. +if (! isset($exptidx) || $exptidx == "") { + USERERROR("Must supply an experiment index!", 1); } -if (!TBvalid_integer($which)) { - USERERROR("Invalid characters in $which!", 1); +if (!TBvalid_integer($exptidx)) { + USERERROR("Invalid characters in $exptidx!", 1); } # -# We get an index. Must map that to a pid/eid to do the permission -# check, and note that it might not be an current experiment. Not -# sure I like this so I am not going to permit it for mere users -# just yet. +# We get an index. Must map that to a pid/gid to do a group level permission +# check, since it might not be an current experiment. # -$query_result = -DBQueryFatal("select pid,eid from experiments where idx='$which'"); -if (mysql_num_rows($query_result) == 0) { - USERERROR("No such experiment index $which!", 1); +unset($pid); +unset($eid); +unset($gid); +if (TBExptidx2PidEid($exptidx, $pid, $eid, $gid) < 0) { + USERERROR("No such experiment index $exptidx!", 1); } -$row = mysql_fetch_array($query_result); -$pid = $row["pid"]; -$eid = $row["eid"]; -if (!$isadmin) { - if (! TBExptAccessCheck($uid, $pid, $eid, $TB_EXPT_READINFO)) { - USERERROR("You do not have permission to view tags for ". - "experiment $pid/$eid ($which)!", 1); - } +if (!$isadmin && + !TBProjAccessCheck($uid, $pid, $gid, $TB_PROJECT_READINFO)) { + USERERROR("You do not have permission to view tags for ". + "archive in $pid/$gid ($exptidx)!", 1); +} + +if (TBCurrentExperiment($exptidx)) { + echo "
". + "Experiment ". + "$pid/". + "$eid ". + "($exptidx) ". + "\n"; + "

"; +} +else { + echo "
". + "Experiment ". + "$exptidx ". + "\n"; + "

"; } -echo "
". - "Experiment ". - "$pid/". - "$eid ". - "($which) ". - "\n"; - "

"; echo "
\n"; # # We need the archive index so we can find its view. # $query_result = - DBQueryFatal("select s.archive_idx from experiments as e ". - "left join experiment_stats as s on s.exptidx=e.idx ". - "where e.pid='$pid' and e.eid='$eid'"); + DBQueryFatal("select s.archive_idx from experiment_stats as s ". + "where s.exptidx='$exptidx'"); if (mysql_num_rows($query_result) == 0) { - TBERROR("Could not get archive index for experiment $pid/$eid", 1); + TBERROR("Could not get archive index for experiment $exptidx", 1); } $row = mysql_fetch_array($query_result); $archive_idx = $row["archive_idx"]; @@ -79,9 +84,11 @@ $archive_idx = $row["archive_idx"]; # Grab all the (commit/user) tags. # $query_result = - DBQueryFatal("select * from archive_tags ". - "where archive_idx='$archive_idx' and view='$which' and ". - " (tagtype='user' or tagtype='commit')"); + DBQueryFatal("select *,FROM_UNIXTIME(date_created) as date_created ". + " from archive_tags ". + "where archive_idx='$archive_idx' and view='$exptidx' and ". + " (tagtype='user' or tagtype='commit') ". + "order by date_created desc"); if (mysql_num_rows($query_result) == 0) { USERERROR("No tags for experiment $pid/$eid", 1); @@ -90,7 +97,7 @@ if (mysql_num_rows($query_result) == 0) { echo ""; echo " "; -echo " "; +echo " "; echo " "; echo " "; echo "\n"; @@ -102,11 +109,11 @@ while ($row = mysql_fetch_assoc($query_result)) { echo ""; echo " "; echo " "; echo " "; diff --git a/www/archive_view.php3 b/www/archive_view.php3 index 8e5ca0854a56b8564701eaaf56231f452884e3ee..46e3281f66ec8376024862e346bc0be323733447 100644 --- a/www/archive_view.php3 +++ b/www/archive_view.php3 @@ -15,81 +15,72 @@ LOGGEDINORDIE($uid); $isadmin = ISADMIN($uid); # -# Verify page arguments. +# Standard Testbed Header. # -if (isset($exptidx) && $exptidx != "") { - if (!TBvalid_integer($exptidx)) { - PAGEARGERROR("Invalid experiment index."); - } - PAGEHEADER("Experiment Archive ($exptidx)"); +PAGEHEADER("Experiment Archive ($exptidx)"); - unset($pid); - unset($eid); - unset($gid); - TBExptidx2PidEid($exptidx, $pid, $eid, $gid); +# +# Verify page arguments. +# +if (! isset($exptidx) || $exptidx == "") { + USERERROR("Must supply an experiment to view!", 1); +} +if (!TBvalid_integer($exptidx)) { + USERERROR("Invalid characters in $exptidx!", 1); +} - $url = preg_replace("/archive_view/", "cvsweb/cvsweb", - $_SERVER['REQUEST_URI']); +# +# We get an index. Must map that to a pid/gid to do a group level permission +# check, since it might not be an current experiment. +# +unset($pid); +unset($eid); +unset($gid); +if (TBExptidx2PidEid($exptidx, $pid, $eid, $gid) < 0) { + USERERROR("No such experiment index $exptidx!", 1); } -else { - if (!isset($pid) || - strcmp($pid, "") == 0) { - USERERROR("You must provide a Project ID.", 1); - } - if (!isset($eid) || - strcmp($eid, "") == 0) { - USERERROR("You must provide an Experiment ID.", 1); - } - if (!TBvalid_pid($pid)) { - PAGEARGERROR("Invalid project ID."); - } - if (!TBvalid_eid($eid)) { - PAGEARGERROR("Invalid experiment ID."); - } - # - # Check to make sure this is a valid PID/EID tuple. - # - if (! TBValidExperiment($pid, $eid)) { - USERERROR("The experiment $eid is not a valid experiment ". - "in project $pid.", 1); - } - $exptidx = TBExptIndex($pid, $eid); - if ($exptidx < 0) { - TBERROR("Could not get experiment index for $pid/$eid!", 1); - } - PAGEHEADER("Experiment Archive ($pid/$eid)"); - - $url = "cvsweb/cvsweb.php3/${exptidx}?exptidx=$exptidx"; +if (!$isadmin && + !TBProjAccessCheck($uid, $pid, $gid, $TB_PROJECT_READINFO)) { + USERERROR("You do not have permission to view tags for ". + "archive in $pid/$gid ($exptidx)!", 1); } +$current = TBCurrentExperiment($exptidx); + +$url = preg_replace("/archive_view/", "cvsweb/cvsweb", + $_SERVER['REQUEST_URI']); # This is how you get forms to align side by side across the page. -$style = 'style="float:left; width:33%;"'; +if ($current) { + $style = 'style="float:left; width:33%;"'; +} +else { + $style = ""; +} echo "
\n"; echo " - This is the Subversion archive for your experiment.
"; -if (isset($pid)) { + This is the Subversion archive for experiment $exptidx.
"; + +if ($current) { echo "\n"; echo ""; - echo ""; - echo ""; + echo ""; echo ""; } echo "
"; echo ""; -echo ""; +echo ""; echo ""; -if (isset($pid)) { -echo "
"; -echo ""; -echo ""; -echo ""; -echo ""; +if ($current) { + echo "
"; + echo ""; + echo ""; + echo ""; } -echo "
\n"; +echo "
\n"; echo "\n"; diff --git a/www/cvsweb/cvsweb.php3 b/www/cvsweb/cvsweb.php3 index 9c845840c3f546e07bc2ad044d7ae359c5206587..041952661fd04c8c3947d8ffeacad8d3c481840f 100644 --- a/www/cvsweb/cvsweb.php3 +++ b/www/cvsweb/cvsweb.php3 @@ -141,7 +141,7 @@ elseif (isset($exptidx) && $exptidx != "") { if (! ISADMIN($uid)) { USERERROR("Must be administrator to view historical archives!", 1); } - $repodir = "$TBDIR/expinfo/${pid}-${eid}.${exptidx}/Archive/repo"; + $repodir = "/usr/testbed/exparchive/Archive/$repoidx/repo/"; } $use_viewvc = 1; } diff --git a/www/dbdefs.php3.in b/www/dbdefs.php3.in index f1270f69f021abee0dfb6037fedcc27e32db504b..f3feaca801cdc5fe6c528a1778b08d6af52bdaf6 100644 --- a/www/dbdefs.php3.in +++ b/www/dbdefs.php3.in @@ -1140,6 +1140,19 @@ function TBValidExperiment($pid, $eid) return 1; } +function TBCurrentExperiment($exptidx) +{ + $exptidx = addslashes($exptidx); + + $query_result = + DBQueryFatal("select eid from experiments where idx='$exptidx'"); + + if (mysql_num_rows($query_result) == 0) { + return 0; + } + return 1; +} + # # Confirm a valid node name. # @@ -1365,8 +1378,8 @@ function TBExptIndex($pid, $eid) function TBExptidx2PidEid($exptidx, &$pid, &$eid, &$gid) { $query_result = - DBQueryFatal("select pid,eid,gid from experiments ". - "where idx='$exptidx'"); + DBQueryFatal("select pid,eid,gid from experiment_stats ". + "where exptidx='$exptidx'"); if (mysql_num_rows($query_result) == 0) { return -1; diff --git a/www/showexp.php3 b/www/showexp.php3 index ff4546cacbb05d86e977820cb1a6dc4254dd9f8b..4110aaa02aaac9cc6fd1874f03161c93e736e469 100644 --- a/www/showexp.php3 +++ b/www/showexp.php3 @@ -304,7 +304,7 @@ if (!$instance && STUDLY()) { if ($EXPOSEARCHIVE) { WRITESUBMENUBUTTON("Experiment File Archive", - "archive_view.php3?pid=$exp_pid&eid=$exp_eid"); + "archive_view.php3?exptidx=$expindex"); } if ($types['garcia'] || $types['static-mica2'] || $types['robot']) { diff --git a/www/template_show.php b/www/template_show.php index bdc97183fc26c9b34df3aae85fa1275ae22422f3..6807c9aa2ba0ef9287013f3909c04a30a328846e 100644 --- a/www/template_show.php +++ b/www/template_show.php @@ -19,6 +19,7 @@ $pid = ""; $eid = ""; $gid = ""; $template = NULL; +$exptidx = 0; function CheckArguments($guid, $version) { global $TB_EXPT_READINFO; @@ -53,7 +54,8 @@ function CheckArguments($guid, $version) { $pid = $template->pid(); $gid = $template->gid(); $eid = $template->eid(); - + $exptidx = TBExptIndex($pid, $eid); + # # Verify Permission. # @@ -131,7 +133,7 @@ WRITESUBMENUBUTTON("Add Metadata", "guid=$guid&version=$version"); WRITESUBMENUBUTTON("Template Archive", - "archive_view.php3?pid=$pid&eid=$eid"); + "archive_view.php3?exptidx=$exptidx"); WRITESUBMENUBUTTON("Template History", "template_history.php?guid=$guid&version=$version");
RunTagTag (Click to visit archive)DateDescription
- + Run". - "$archive_tag". + "$archive_tag". " $date_tagged