Commit c2302569 authored by Leigh B Stoller's avatar Leigh B Stoller

Add IsShutdown(), to return the value of the testbed_shutdown sitevar.

parent 39e1a273
......@@ -9,7 +9,7 @@ use strict;
use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(SiteVarExists GetSiteVar SetSiteVar NoLogins);
@EXPORT = qw(SiteVarExists GetSiteVar SetSiteVar NoLogins IsShutDown);
use emdb;
......@@ -123,6 +123,10 @@ sub SetSiteVar($$)
#
sub NoLogins()
{
my $shutdown = IsShutDown();
return 1
if ($shutdown);
my $query_result =
DBQueryWarn("select value from sitevariables ".
"where name='web/nologins'");
......@@ -136,4 +140,20 @@ sub NoLogins()
return ($value ? 1 : 0);
}
# Ditto shutdown.
sub IsShutDown()
{
my $query_result =
DBQueryWarn("select value from sitevariables ".
"where name='general/testbed_shutdown'");
return 1
if (!$query_result);
return 0
if (!$query_result->numrows);
my ($value) = $query_result->fetchrow_array();
return ($value ? 1 : 0);
}
1;
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