Bug 454 - Ensure that the correct version is stored in the DB so upgrades can be automatic.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2308 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan
2008-02-13 23:01:07 +00:00
parent ca5886719c
commit 630f74b5ce
2 changed files with 5 additions and 1 deletions

View File

@@ -820,7 +820,7 @@ insert into Config set Id = 170, Name = 'ZM_WEB_P_DEFAULT_RATE', Value = '100',
insert into Config set Id = 171, Name = 'ZM_WEB_P_SCALE_THUMBS', Value = '1', Type = 'boolean', DefaultValue = 'yes', Hint = 'yes|no', Pattern = '(?i-xsm:^([yn]))', Format = ' ($1 =~ /^y/) ? \"yes\" : \"no\" ', Prompt = 'Whether to scale thumbnails in events, bandwidth versus cpu in rescaling', Help = 'If unset, this option sends the whole image to the browser which resizes it in the window. If set the image is scaled down on the server before sending a reduced size image to the browser to conserve bandwidth at the cost of cpu on the server', Category = 'phoneband', Readonly = '0', Requires = 'ZM_PATH_NETPBM=/';
insert into Config set Id = 172, Name = 'ZM_DYN_LAST_VERSION', Value = '', Type = 'string', DefaultValue = '', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'What the last version of ZoneMinder recorded from zoneminder.com is', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 173, Name = 'ZM_DYN_CURR_VERSION', Value = '1.23.1', Type = 'string', DefaultValue = '1.23.1', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'What the effective current version of ZoneMinder is, might be different from actual if versions ignored', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 174, Name = 'ZM_DYN_DB_VERSION', Value = '', Type = 'string', DefaultValue = '', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'What the version of the database is, from zmupdate', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 174, Name = 'ZM_DYN_DB_VERSION', Value = '@VERSION@', Type = 'string', DefaultValue = '', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'What the version of the database is, from zmupdate', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 175, Name = 'ZM_DYN_LAST_CHECK', Value = '', Type = 'integer', DefaultValue = '', Hint = 'integer', Pattern = '(?-xism:^(\d+)$)', Format = ' $1 ', Prompt = 'When the last check for version from zoneminder.com was', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 176, Name = 'ZM_DYN_NEXT_REMINDER', Value = '', Type = 'string', DefaultValue = '', Hint = 'string', Pattern = '(?-xism:^(.+)$)', Format = ' $1 ', Prompt = 'When the earliest time to remind about versions will be', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';
insert into Config set Id = 177, Name = 'ZM_DYN_DONATE_REMINDER_TIME', Value = '0', Type = 'integer', DefaultValue = '0', Hint = 'integer', Pattern = '(?-xism:^(\d+)$)', Format = ' $1 ', Prompt = 'When the earliest time to remind about donations will be', Help = '', Category = 'dynamic', Readonly = '1', Requires = '';

View File

@@ -145,6 +145,10 @@ sub generateConfigSQL
{
$option->{db_value} = $option->{value};
}
if ( $option->{name} eq "ZM_DYN_CURR_VERSION" || $option->{name} eq "ZM_DYN_DB_VERSION" )
{
$option->{db_value} = '@VERSION@';
}
if ( my $requires = $option->{requires} )
{
$option->{db_requires} = join( ";", map { my $value = $_->{value}; $value = ($value eq "yes")?1:0 if ( $options_hash{$_->{name}}->{db_type} eq "boolean" ); ( "$_->{name}=$value" ) } @$requires );