Skip to content

Commit

Permalink
Updates for version 1.24.4
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3358 e3e1d417-86f3-4887-817a-d78f3d33393f
  • Loading branch information
stan committed May 23, 2011
1 parent 7b43ac2 commit 58c77d2
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AC_PREREQ(2.59)
AC_INIT(zm,1.24.3,[email protected],ZoneMinder,http://www.zoneminder.com/downloads.html)
AC_INIT(zm,1.24.4,[email protected],ZoneMinder,http://www.zoneminder.com/downloads.html)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR(src/zm.h)
AM_CONFIG_HEADER(config.h)
Expand Down
3 changes: 2 additions & 1 deletion db/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ EXTRA_DIST = \
zm_update-1.23.3.sql \
zm_update-1.24.0.sql \
zm_update-1.24.1.sql \
zm_update-1.24.2.sql
zm_update-1.24.2.sql \
zm_update-1.24.3.sql
13 changes: 13 additions & 0 deletions db/zm_update-1.24.3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--
-- This updates a 1.24.3 database to the next version
--

--
-- These are optional, but we might as well do it now
--
optimize table Frames;
optimize table Events;
optimize table Filters;
optimize table Zones;
optimize table Monitors;
optimize table Stats;
35 changes: 35 additions & 0 deletions scripts/zmupdate.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,41 @@ if ( $version )
patchDB( $dbh, "1.24.2" );
$cascade = !undef;
}
if ( $cascade || $version eq "1.24.3" )
{
my $result = eval
{
require PHP::Serialization;
PHP::Serialization->import();
};
die( "Unable to perform upgrade from 1.24.3, PHP::Serialization module not found" ) if ( $result );

# Patch the database
patchDB( $dbh, "1.24.3" );

# Convert filters to JSON from PHP format serialisation
{
my $sql = "select * from Filters";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute() or die( "Can't execute: ".$sth->errstr() );
my @dbFilters;
while( my $dbFilter = $sth->fetchrow_hashref() )
{
push( @dbFilters, $dbFilter );
}
$sth->finish();
foreach my $dbFilter ( @dbFilters )
{
my $phpQuery = $dbFilter->{Query};
my $query = PHP::Serialization::unserialize( $phpQuery );
my $jsonQuery = jsonEncode( $query );
my $sql = "update Filters set Query = ? where Name = ?";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute( $jsonQuery, $dbFilter->{Name} ) or die( "Can't execute: ".$sth->errstr() );
}
}
$cascade = !undef;
}
if ( $cascade )
{
my $installed_version = ZM_VERSION;
Expand Down

0 comments on commit 58c77d2

Please sign in to comment.