Polls now use JSON instead of Storable to store graph info because Storable is not portable between OS/processors.

This commit is contained in:
Doug Bell 2007-08-14 17:07:28 +00:00
parent a2e3b54eb7
commit 8b8feb6af3
4 changed files with 128 additions and 24 deletions

View file

@ -2,6 +2,7 @@
- Data Forms set reply to to the same as the from field
- Config file bugs fixed, see gotcha.txt for details.
- Added export to context menu in asset manager
- Polls now use JSON instead of Storable to serialize graph config
7.4.2

View file

@ -13,6 +13,14 @@ save you many hours of grief.
* You must upgrade to Config::JSON 1.1.0 or higher prior to upgrading.
Due to a bug in CPAN you should type "force install Config::JSON" in
order to upgrade to this version.
* For Poll Wobjects, we're using a new way to store the graph
configuration. If you were having problems with your Poll graphs,
you will need to re-create the graph's configuration. It may not
be possible to read your graph configuration, so if you have
problems with the Poll graphs you will need to re-create the graph's
configuration. After you create a new configuration, everything will
work fine.
7.4.0

View file

@ -21,6 +21,7 @@ my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
reserializePollGraphConfigs($session);
finish($session); # this line required
@ -32,6 +33,41 @@ finish($session); # this line required
# # and here's our code
#}
#-------------------------------------------------
sub reserializePollGraphConfigs {
my $session = shift;
print "\tRe-serializing Poll Graph configuration... " unless ($quiet);
use Storable;
$Storable::canonical = 1;
use JSON;
my $sth = $session->db->read(
"SELECT assetId, revisionDate, graphConfiguration FROM Poll"
);
while (my %data = $sth->hash) {
next unless $data{graphConfiguration};
my ($assetId, $revisionDate, $graphConfiguration)
= @data{'assetId', 'revisionDate', 'graphConfiguration'};
my $thawed = eval { Storable::thaw($graphConfiguration) };
if ($@) {
print "\n\t!!! Could not fix graph configuration for assetId '$assetId' revisionDate '$revisionDate' !!!";
next;
}
$graphConfiguration = objToJson( $thawed );
$session->db->write(
"UPDATE Poll SET graphConfiguration=? WHERE assetId=? AND revisionDate=?",
[$graphConfiguration, $assetId, $revisionDate],
);
}
print "OK!\n" unless $quiet;
}
# ---- DO NOT EDIT BELOW THIS LINE ----