Re-Implement file check for db_update.pl in Database::CheckDatabaseConversions() so when the file exists it isn't re-downloaded

Increment db_update.pl current version to version 2
Update Database::CheckDatabaseConversions() to check for version 2 of db_update.pl
This commit is contained in:
Akkadius 2015-01-25 20:48:30 -06:00
parent d51271dc6d
commit 9d9df6931e
2 changed files with 7 additions and 7 deletions

View File

@ -463,14 +463,14 @@ bool Database::CheckDatabaseConversions() {
CheckDatabaseConvertCorpseDeblob(); CheckDatabaseConvertCorpseDeblob();
/* Fetch Automatic Database Upgrade Script */ /* Fetch Automatic Database Upgrade Script */
// if (!std::ifstream("db_update.pl")){ if (!std::ifstream("db_update.pl")){
std::cout << "Pulling down automatic database upgrade script...\n" << std::endl; std::cout << "Pulling down automatic database upgrade script...\n" << std::endl;
#ifdef _WIN32 #ifdef _WIN32
system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl'); if ($response->is_success){ open(FILE, '> db_update.pl'); print FILE $response->decoded_content; close(FILE); }\""); system("perl -MLWP::UserAgent -e \"require LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get('https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl'); if ($response->is_success){ open(FILE, '> db_update.pl'); print FILE $response->decoded_content; close(FILE); }\"");
#else #else
system("wget -O db_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl"); system("wget --no-check-certificate -O db_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl");
#endif #endif
// } }
/* /*
Automatic Database Upgrade Script Automatic Database Upgrade Script
@ -483,7 +483,7 @@ bool Database::CheckDatabaseConversions() {
/* Check for a new version of this script, the arg passed /* Check for a new version of this script, the arg passed
would have to be higher than the copy they have downloaded would have to be higher than the copy they have downloaded
locally and they will re fetch */ locally and they will re fetch */
system("perl db_update.pl V 1"); system("perl db_update.pl V 2");
/* Run Automatic Database Upgrade Script */ /* Run Automatic Database Upgrade Script */
system("perl db_update.pl ran_from_world"); system("perl db_update.pl ran_from_world");

View File

@ -9,7 +9,7 @@
$menu_displayed = 0; $menu_displayed = 0;
#::: If current version is less than what world is reporting, then download a new one... #::: If current version is less than what world is reporting, then download a new one...
$current_version = 1; $current_version = 2;
if($ARGV[0] eq "V"){ if($ARGV[0] eq "V"){
if($ARGV[1] > $current_version){ if($ARGV[1] > $current_version){