Skip to content
GitLab
Menu
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
9f1b6c28
Commit
9f1b6c28
authored
Aug 08, 2017
by
Leigh B Stoller
Browse files
Kill existing feature check function (which called out to perl) and
replace with new one that looks in the DB directly.
parent
2b11e26d
Changes
2
Hide whitespace changes
Inline
Side-by-side
www/dbdefs.php3.in
View file @
9f1b6c28
...
...
@@ -866,6 +866,59 @@ class Logfile
function
gid_idx
()
{
return
$this
->
field
(
"gid_idx"
);
}
}
function
FeatureEnabled
(
$feature
,
$user
,
$group
,
$experiment
=
null
)
{
#
# See if feature is globally disabled or enabled.
#
$query_result
=
DBQueryFatal
(
"select * from emulab_features where feature='
$feature
'"
);
if
(
!
mysql_num_rows
(
$query_result
))
{
return
0
;
}
$frow
=
mysql_fetch_array
(
$query_result
);
if
(
$frow
[
"disabled"
])
{
return
0
;
}
if
(
$frow
[
"enabled"
])
{
return
1
;
}
$enabled
=
0
;
if
(
$user
)
{
$uid_idx
=
$user
->
idx
();
$query_result
=
DBQueryFatal
(
"select * from user_features "
.
"where feature='
$feature
' and uid_idx='
$uid_idx
'"
);
$enabled
+=
mysql_num_rows
(
$query_result
);
}
if
(
$group
)
{
$pid_idx
=
$group
->
pid_idx
();
$gid_idx
=
$group
->
gid_idx
();
$query_result
=
DBQueryFatal
(
"select * from group_features "
.
"where feature='
$feature
' and "
.
" pid_idx='
$pid_idx
' and gid_idx='
$gid_idx
'"
);
$enabled
+=
mysql_num_rows
(
$query_result
);
}
if
(
$experiment
)
{
$exptidx
=
$experiment
->
idx
();
$query_result
=
DBQueryWarn
(
"select * from experiment_features "
.
"where feature='
$feature
' and "
.
" exptidx='
$exptidx
'"
);
$enabled
+=
mysql_num_rows
(
$query_result
);
}
return
$enabled
;
}
#
# Do we have a storage pool?
#
...
...
www/defs.php3.in
View file @
9f1b6c28
...
...
@@ -522,27 +522,6 @@ function ADDPUBKEY($cmdandargs) {
SUEXEC_ACTION_CONTINUE
);
}
#
# Check an emulab feature, calling out to the perl code.
#
function
FeatureEnabled
(
$feature
,
$user
,
$group
)
{
$command
=
"webemulabfeature check
$feature
"
;
if
(
$user
)
{
$command
.
=
"-u "
.
$user
->
uid
()
.
" "
;
}
if
(
$group
)
{
$command
.
=
"-g "
.
$group
->
pid
()
.
","
.
$group
->
gid
();
}
$retval
=
SUEXEC
(
"nobody"
,
"nobody"
,
$command
,
SUEXEC_ACTION_IGNORE
);
if
(
$retval
<
0
)
{
SUEXECERROR
(
SUEXEC_ACTION_CONTINUE
);
return
0
;
}
return
$retval
;
}
#
# Verify a URL.
#
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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