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
2ca17d8a
Commit
2ca17d8a
authored
Apr 26, 2010
by
Leigh B Stoller
Browse files
Add a NoLogins() predicate for use in daemons and scripts.
parent
715bc460
Changes
1
Hide whitespace changes
Inline
Side-by-side
db/emutil.pm.in
View file @
2ca17d8a
#
!/usr/bin/perl -w
#
#
EMULAB
-
COPYRIGHT
#
Copyright
(
c
)
2000
-
200
9
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2000
-
20
1
0
University
of
Utah
and
the
Flux
Group
.
#
All
rights
reserved
.
#
#
Utility
routines
for
Emulab
.
...
...
@@ -13,7 +13,7 @@ use vars qw(@ISA @EXPORT);
@
ISA
=
"Exporter"
;
@
EXPORT
=
qw
(
TBDB_CHECKDBSLOT_NOFLAGS
TBDB_CHECKDBSLOT_WARN
TBDB_CHECKDBSLOT_ERROR
TBcheck_dbslot
TBFieldErrorString
TBGetUniqueIndex
ParRun
);
TBGetUniqueIndex
ParRun
NoLogins
);
use
emdb
;
use
English
;
...
...
@@ -464,6 +464,26 @@ sub ParRun($$$@)
return 0;
}
#
# Check for nologins; web interface disabled means other interfaces
# should be disabled. Not using libdb:GetSiteVar cause do not want to
# drag all that stuff in. Predicate; retun 1 if no logins is set.
#
sub NoLogins()
{
my $query_result =
DBQueryWarn("select value from sitevariables ".
"where name='
web
/
nologins
'");
return 1
if (!$query_result);
return 0
if (!$query_result->numrows);
my ($value) = $query_result->fetchrow_array();
return ($value ? 1 : 0);
}
# _Always_ make sure that this 1 is at the end of the file...
1;
...
...
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