Hot-fix --version-check.

This commit is contained in:
Daniel Nichter
2013-03-20 11:53:36 -06:00
parent d9a4b772af
commit 24cabaa46a
19 changed files with 405 additions and 76 deletions

View File

@@ -4560,10 +4560,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now);
my %all_instances = map {
$_->{id} => { name => $_->{name}, ts => $now }
} @$instances;
if ( -f $vc_file ) {
open my $fh, '<', $vc_file or die "Cannot read $vc_file: $OS_ERROR";
my $contents = do { local $/ = undef; <$fh> };
close $fh;
foreach my $line ( split("\n", ($contents || '')) ) {
my ($id, $ts) = split(',', $line);
if ( !exists $all_instances{$id} ) {
$all_instances{$id} = { ts => $ts }; # original ts, not updated
}
}
}
open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) {
PTDEBUG && _d('Updated:', Dumper($instance));
print { $fh } $instance->{id} . ',' . $now . "\n";
foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
}
close $fh;
@@ -4598,7 +4615,7 @@ sub get_instance_id {
}
my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn);
PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id;
}