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

@@ -4977,10 +4977,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -5015,7 +5032,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -4682,10 +4682,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -4720,7 +4737,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -3747,10 +3747,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -3785,7 +3802,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -4351,10 +4351,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -4389,7 +4406,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -4323,10 +4323,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -4361,7 +4378,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -3135,10 +3135,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -3173,7 +3190,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -3257,10 +3257,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -3295,7 +3312,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -4303,10 +4303,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -4341,7 +4358,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -5778,10 +5778,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -5816,7 +5833,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -6032,10 +6032,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -6070,7 +6087,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -7062,10 +7062,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -7100,7 +7117,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -12030,10 +12030,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -12068,7 +12085,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -3653,10 +3653,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -3691,7 +3708,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -4302,10 +4302,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -4340,7 +4357,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -905,10 +905,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -943,7 +960,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -9140,10 +9140,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -9178,7 +9195,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -4058,10 +4058,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -4096,7 +4113,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -4560,10 +4560,27 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); 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"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -4598,7 +4615,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }

View File

@@ -249,10 +249,33 @@ sub update_check_times {
my $vc_file = $args{vc_file} || version_check_file(); my $vc_file = $args{vc_file} || version_check_file();
PTDEBUG && _d('Updating last check time:', $now); PTDEBUG && _d('Updating last check time:', $now);
# We need to write back all instances to the file. The given
# instances are the ones updated, so use the current ts (now).
my %all_instances = map {
$_->{id} => { name => $_->{name}, ts => $now }
} @$instances;
# If the file exists, read the instances in it, and if they're
# not one of the updated ones, save them with their original ts.
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
}
}
}
# Write back all instances, some with updated ts, others with their
# original ts.
open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR"; open my $fh, '>', $vc_file or die "Cannot write to $vc_file: $OS_ERROR";
foreach my $instance ( sort { $a->{id} cmp $b->{id} } @$instances ) { foreach my $id ( sort keys %all_instances ) {
PTDEBUG && _d('Updated:', Dumper($instance)); PTDEBUG && _d('Updated:', $id, Dumper($all_instances{$id}));
print { $fh } $instance->{id} . ',' . $now . "\n"; print { $fh } $id . ',' . $all_instances{$id}->{ts} . "\n";
} }
close $fh; close $fh;
@@ -293,7 +316,7 @@ sub get_instance_id {
} }
my $id = md5_hex($name); my $id = md5_hex($name);
PTDEBUG && _d('MySQL instance:', $id, $name, $dsn); PTDEBUG && _d('MySQL instance:', $id, $name, Dumper($dsn));
return $name, $id; return $name, $id;
} }