Add Private to Config
This commit is contained in:
parent
45db266ede
commit
35efb111ac
|
@ -39,6 +39,7 @@ CREATE TABLE `Config` (
|
||||||
`Help` text,
|
`Help` text,
|
||||||
`Category` varchar(32) NOT NULL default '',
|
`Category` varchar(32) NOT NULL default '',
|
||||||
`Readonly` tinyint(3) unsigned NOT NULL default '0',
|
`Readonly` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`Private` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
`Requires` text,
|
`Requires` text,
|
||||||
PRIMARY KEY (`Name`)
|
PRIMARY KEY (`Name`)
|
||||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
--
|
||||||
|
-- Update Config table to have Private
|
||||||
|
--
|
||||||
|
|
||||||
|
SELECT 'Checking for Private in Config';
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*)
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE table_name = 'Config'
|
||||||
|
AND table_schema = DATABASE()
|
||||||
|
AND column_name = 'Private'
|
||||||
|
) > 0,
|
||||||
|
"SELECT 'Column Private already exists in Config'",
|
||||||
|
"ALTER TABLE `Config` ADD COLUMN `Private` BOOLEAN NOT NULL DEFAULT FALSE AFTER `Readonly`"
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ sub loadConfigFromDB {
|
||||||
print("Error: unable to load options from database: $DBI::errstr\n");
|
print("Error: unable to load options from database: $DBI::errstr\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
my $sql = "select * from Config";
|
my $sql = 'SELECT * FROM Config';
|
||||||
my $sth = $dbh->prepare_cached( $sql )
|
my $sth = $dbh->prepare_cached( $sql )
|
||||||
or croak( "Can't prepare '$sql': ".$dbh->errstr() );
|
or croak( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||||
my $res = $sth->execute()
|
my $res = $sth->execute()
|
||||||
|
@ -203,7 +203,7 @@ sub saveConfigToDB {
|
||||||
my $res = $dbh->do( $sql )
|
my $res = $dbh->do( $sql )
|
||||||
or croak( "Can't do '$sql': ".$dbh->errstr() );
|
or croak( "Can't do '$sql': ".$dbh->errstr() );
|
||||||
|
|
||||||
$sql = "replace into Config set Id = ?, Name = ?, Value = ?, Type = ?, DefaultValue = ?, Hint = ?, Pattern = ?, Format = ?, Prompt = ?, Help = ?, Category = ?, Readonly = ?, Requires = ?";
|
$sql = "replace into Config set Id = ?, Name = ?, Value = ?, Type = ?, DefaultValue = ?, Hint = ?, Pattern = ?, Format = ?, Prompt = ?, Help = ?, Category = ?, Readonly = ?, Private = ?, Requires = ?";
|
||||||
my $sth = $dbh->prepare_cached( $sql )
|
my $sth = $dbh->prepare_cached( $sql )
|
||||||
or croak( "Can't prepare '$sql': ".$dbh->errstr() );
|
or croak( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||||
foreach my $option ( @options ) {
|
foreach my $option ( @options ) {
|
||||||
|
@ -240,6 +240,7 @@ sub saveConfigToDB {
|
||||||
$option->{help},
|
$option->{help},
|
||||||
$option->{category},
|
$option->{category},
|
||||||
$option->{readonly} ? 1 : 0,
|
$option->{readonly} ? 1 : 0,
|
||||||
|
$option->{private} ? 1 : 0,
|
||||||
$option->{db_requires}
|
$option->{db_requires}
|
||||||
) or croak("Can't execute when updating config entry $$option{name}: ".$sth->errstr() );
|
) or croak("Can't execute when updating config entry $$option{name}: ".$sth->errstr() );
|
||||||
} # end foreach option
|
} # end foreach option
|
||||||
|
|
|
@ -304,6 +304,7 @@ our @options = (
|
||||||
{ name=>'ZM_AUTH_RELAY', value=>'hashed' }
|
{ name=>'ZM_AUTH_RELAY', value=>'hashed' }
|
||||||
],
|
],
|
||||||
type => $types{string},
|
type => $types{string},
|
||||||
|
private => 1,
|
||||||
category => 'system',
|
category => 'system',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -462,6 +463,7 @@ our @options = (
|
||||||
{name=>'ZM_OPT_USE_GOOG_RECAPTCHA', value=>'yes'}
|
{name=>'ZM_OPT_USE_GOOG_RECAPTCHA', value=>'yes'}
|
||||||
],
|
],
|
||||||
type => $types{string},
|
type => $types{string},
|
||||||
|
private => 1,
|
||||||
category => 'system',
|
category => 'system',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -477,6 +479,7 @@ our @options = (
|
||||||
{name=>'ZM_OPT_USE_GOOG_RECAPTCHA', value=>'yes'}
|
{name=>'ZM_OPT_USE_GOOG_RECAPTCHA', value=>'yes'}
|
||||||
],
|
],
|
||||||
type => $types{string},
|
type => $types{string},
|
||||||
|
private => 1,
|
||||||
category => 'system',
|
category => 'system',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue