first commit
This commit is contained in:
62
updateheisql.pl
Normal file
62
updateheisql.pl
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/perl -w
|
||||
use warnings;
|
||||
use File::Slurp qw(:std);
|
||||
use Win32::File::VersionInfo;
|
||||
use Archive::Zip; # imports
|
||||
# use IO::Socket::SSL;
|
||||
use LWP::UserAgent;
|
||||
use Data::Printer;
|
||||
use Crypt::SSLeay;
|
||||
use Net::SSL;
|
||||
use Data::Dumper;
|
||||
use File::Copy;
|
||||
|
||||
$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL";
|
||||
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
|
||||
|
||||
my $url = 'https://www.heidisql.com/download.php#nightlybuilds';
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 10);
|
||||
$ua->show_progress( 1 );
|
||||
#my $response = $ua->get($url, ':content_file' => $downloadfolder.$filename);
|
||||
my $response = $ua->get($url);
|
||||
my $html = $response->{_content};
|
||||
|
||||
my @match = $html =~ /\/builds\/heidisql64\.r(....)\.exe/g ;
|
||||
my $heisql = "C:\\Program Files\\HeidiSQL\\heidisql.exe";
|
||||
my $foo = GetFileVersionInfo( $heisql );
|
||||
my $downloadfolder = 'C:\\dts\\';
|
||||
my $filename = '';
|
||||
if ( scalar @match > 0 ) {
|
||||
$url = "https://www.heidisql.com/builds/heidisql64.r$match[0].exe";
|
||||
$filename = "heidisql64.r$match[0].exe";
|
||||
if ( $foo->{FileVersion} =~ /$match[0]/ ) {
|
||||
print "Version $foo->{FileVersion} ist die neuste und ist installiert\n";
|
||||
system("pause");
|
||||
exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
print "keine Version gefunden\n";
|
||||
system("pause");
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( -e $downloadfolder.$filename ) {
|
||||
print "neue Nightly bereits runtergeladen\n";
|
||||
} else {
|
||||
print "downloade neue Nighlyversion\n";
|
||||
my $ua = LWP::UserAgent->new(timeout => 10);
|
||||
$ua->show_progress( 1 );
|
||||
my $response = $ua->get($url, ':content_file' => $downloadfolder.$filename);
|
||||
}
|
||||
|
||||
if ( -e $downloadfolder.$filename ) {
|
||||
print "copy neue Nightly\n";
|
||||
unlink $heisql;
|
||||
copy($downloadfolder.$filename, $heisql);
|
||||
}
|
||||
|
||||
system("pause");
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user