From c02e4454abdcea5beff2b7a3786c9245be4d629b Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 7 Mar 2013 23:29:42 -0800 Subject: [PATCH] Fixed config check code --- minecraft/index.cgi | 10 +++++++--- minecraft/minecraft-lib.pl | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/minecraft/index.cgi b/minecraft/index.cgi index 971537261..729723c7e 100755 --- a/minecraft/index.cgi +++ b/minecraft/index.cgi @@ -41,16 +41,20 @@ elsif ($err) { if (time() - $config{'last_check'} > 6*60*60) { my $sz = &check_server_download_size(); $config{'last_check'} = time(); + $config{'last_size'} = $sz; &save_module_config(); + } +if ($config{'last_size'}) { my $jar = $config{'minecraft_jar'} || $config{'minecraft_dir'}."/"."minecraft_server.jar"; my @st = stat($jar); - if (@st && $sz && $st[7] != $sz) { - print "
\n"; + if (@st && $st[7] != $config{'last_size'}) { + print "". + "

"; print &ui_form_start("download.cgi"); print "$text{'index_upgradedesc'}\n"; print &ui_form_end([ [ undef, $text{'index_upgrade'} ] ]); - print "\n"; + print "
\n"; } } diff --git a/minecraft/minecraft-lib.pl b/minecraft/minecraft-lib.pl index 631ee4485..dff206321 100644 --- a/minecraft/minecraft-lib.pl +++ b/minecraft/minecraft-lib.pl @@ -589,13 +589,13 @@ return undef if (!ref($h)); # Read headers my $line; -($line = &read_http_connection($_[0])) =~ tr/\r\n//d; +($line = &read_http_connection($h)) =~ tr/\r\n//d; if ($line !~ /^HTTP\/1\..\s+(200)(\s+|$)/) { return undef; } my %header; while(1) { - $line = &read_http_connection($_[0]); + $line = &read_http_connection($h); $line =~ tr/\r\n//d; $line =~ /^(\S+):\s+(.*)$/ || last; $header{lc($1)} = $2;