From a5b77981b7c4ee630ea2a10d3e909f2e7c458f97 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Sun, 25 Jan 2015 21:23:50 -0600 Subject: [PATCH] Rename db_update.pl to eqemu_update.pl so that the script is more of a generic upgrade script for future add-ons as well as implementing versioning without waiting for everyone to download the copy of the script that successfully self-updates. [skip ci] --- common/database_conversions.cpp | 22 ++++++++--------- .../scripts/{db_update.pl => eqemu_update.pl} | 24 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) rename utils/scripts/{db_update.pl => eqemu_update.pl} (97%) diff --git a/common/database_conversions.cpp b/common/database_conversions.cpp index 1766d683a..8a938e8b5 100644 --- a/common/database_conversions.cpp +++ b/common/database_conversions.cpp @@ -462,31 +462,31 @@ bool Database::CheckDatabaseConversions() { CheckDatabaseConvertBotsPostPPDeblob(); CheckDatabaseConvertCorpseDeblob(); - /* Fetch Automatic Database Upgrade Script */ - if (!std::ifstream("db_update.pl")){ - std::cout << "Pulling down automatic database upgrade script...\n" << std::endl; + /* Fetch Automatic Upgrade Script */ + if (!std::ifstream("eqemu_update.pl")){ + std::cout << "Pulling down automatic database upgrade script..." << std::endl; #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/eqemu_update.pl'); if ($response->is_success){ open(FILE, '> eqemu_update.pl'); print FILE $response->decoded_content; close(FILE); }\""); #else - system("wget --no-check-certificate -O db_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl"); + system("wget --no-check-certificate -O eqemu_update.pl https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_update.pl"); #endif } /* - Automatic Database Upgrade Script - Script: db_update.pl V 1 - the number that world passes to the script will + Automatic (Database) Upgrade Script + Script: eqemu_update.pl V 1 - the number that world passes to the script will force the script to check for a newer version to update itself with - db_update.pl ran_from_world - won't bring up a menu if your database versions match - db_update.pl - ran standalone will bring up a menu prompt + eqemu_update.pl ran_from_world - won't bring up a menu if your database versions match + eqemu_update.pl - ran standalone will bring up a menu prompt */ /* Check for a new version of this script, the arg passed would have to be higher than the copy they have downloaded locally and they will re fetch */ - system("perl db_update.pl V 2"); + system("perl eqemu_update.pl V 2"); /* Run Automatic Database Upgrade Script */ - system("perl db_update.pl ran_from_world"); + system("perl eqemu_update.pl ran_from_world"); return true; } diff --git a/utils/scripts/db_update.pl b/utils/scripts/eqemu_update.pl similarity index 97% rename from utils/scripts/db_update.pl rename to utils/scripts/eqemu_update.pl index ac32f91b4..975170115 100644 --- a/utils/scripts/db_update.pl +++ b/utils/scripts/eqemu_update.pl @@ -1,26 +1,31 @@ #!/usr/bin/perl ########################################################### -#::: Automatic Database Upgrade Script +#::: Automatic (Database) Upgrade Script #::: Author: Akkadius #::: Purpose: To upgrade databases with ease and maintain versioning ########################################################### $menu_displayed = 0; +use Config; +$console_output .= " Operating System is: $Config{osname}\n"; +if($Config{osname}=~/linux/i){ $OS = "Linux"; } +if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; } + #::: If current version is less than what world is reporting, then download a new one... -$current_version = 2; +$current_version = 1; if($ARGV[0] eq "V"){ if($ARGV[1] > $current_version){ - print "db_update.pl Automatic Database Upgrade Needs updating...\n"; + print "eqemu_update.pl Automatic Database Upgrade Needs updating...\n"; print " Current version: " . $current_version . "\n"; - print " New version: " . $current_version . "\n"; - GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl", "db_update.pl"); + print " New version: " . $ARGV[1] . "\n"; + GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_update.pl", "eqemu_update.pl"); exit; } else{ - print "No update necessary \n"; + print "[Upgrade Script] No script update necessary \n"; } exit; } @@ -47,15 +52,10 @@ while() { $console_output = "============================================================ - EQEmu: Automatic Database Upgrade Check + EQEmu: Automatic Upgrade Check ============================================================ "; -use Config; -$console_output .= " Operating System is: $Config{osname}\n"; -if($Config{osname}=~/linux/i){ $OS = "Linux"; } -if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; } - if($OS eq "Windows"){ $has_mysql_path = `echo %PATH%`; if($has_mysql_path=~/MySQL|MariaDB/i){