Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
8a78b60d
Commit
8a78b60d
authored
Mar 09, 2005
by
Timothy Stack
Browse files
Also modify the experiment when clearing out feedback data.
parent
565c32e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
www/feedback.php3
View file @
8a78b60d
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-200
4
University of Utah and the Flux Group.
# Copyright (c) 2000-200
5
University of Utah and the Flux Group.
# All rights reserved.
#
include
(
"defs.php3"
);
...
...
@@ -40,6 +40,22 @@ else {
PAGEARGERROR
(
"Must specify pid and eid!"
);
}
$expstate
=
TBExptState
(
$pid
,
$eid
);
if
(
strcmp
(
$expstate
,
$TB_EXPTSTATE_ACTIVE
)
&&
strcmp
(
$expstate
,
$TB_EXPTSTATE_SWAPPED
))
{
USERERROR
(
"You cannot modify an experiment in transition."
,
1
);
}
if
(
!
strcmp
(
$expstate
,
$TB_EXPTSTATE_ACTIVE
))
{
$reboot
=
1
;
$eventrestart
=
1
;
}
else
{
$reboot
=
0
;
$eventrestart
=
0
;
}
if
(
isset
(
$mode
)
&&
strcmp
(
$mode
,
""
))
{
if
(
strcmp
(
$mode
,
"record"
)
&&
strcmp
(
$mode
,
"clear"
))
{
PAGEARGERROR
(
"Mode value,
$mode
, is not 'record' or 'clear'!"
);
...
...
@@ -207,6 +223,53 @@ else if (strcmp($mode, "clear") == 0) {
$retval
=
SUEXEC
(
$uid
,
"
$pid
,
$unix_gid
"
,
"webfeedback
$options
$pid
$gid
$eid
"
,
SUEXEC_ACTION_USERERROR
);
#
# Avoid SIGPROF in child.
#
set_time_limit
(
0
);
$query_result
=
DBQueryFatal
(
"SELECT nsfile from nsfiles "
.
"where pid='
$pid
' and eid='
$eid
'"
);
if
(
mysql_num_rows
(
$query_result
))
{
$row
=
mysql_fetch_array
(
$query_result
);
$nsdata
=
stripslashes
(
$row
[
nsfile
]);
}
else
{
$nsdata
=
""
;
# XXX what to do...
}
list
(
$usec
,
$sec
)
=
explode
(
' '
,
microtime
());
srand
((
float
)
$sec
+
((
float
)
$usec
*
100000
));
$foo
=
rand
();
$nsfile
=
"/tmp/
$uid
-
$foo
.nsfile"
;
if
(
!
(
$fp
=
fopen
(
$nsfile
,
"w"
)))
{
TBERROR
(
"Could not create temporary file
$nsfile
"
,
1
);
}
fwrite
(
$fp
,
$nsdata
);
fclose
(
$fp
);
chmod
(
$nsfile
,
0666
);
$retval
=
SUEXEC
(
$uid
,
"
$pid
,
$unix_gid
"
,
"webswapexp "
.
(
$reboot
?
"-r "
:
""
)
.
(
$eventrestart
?
"-e "
:
""
)
.
"-s modify
$pid
$eid
$nsfile
"
,
SUEXEC_ACTION_IGNORE
);
unlink
(
$nsfile
);
#
# Fatal Error. Report to the user, even though there is not much he can
# do with the error. Also reports to tbops.
#
if
(
$retval
<
0
)
{
SUEXECERROR
(
SUEXEC_ACTION_DIE
);
#
# Never returns ...
#
die
(
""
);
}
}
echo
"<center><h3><br>Done!</h3></center>
\n
"
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment