mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-11 08:52:27 +00:00
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]
This commit is contained in:
parent
38aa7134ad
commit
a5b77981b7
@ -462,31 +462,31 @@ bool Database::CheckDatabaseConversions() {
|
|||||||
CheckDatabaseConvertBotsPostPPDeblob();
|
CheckDatabaseConvertBotsPostPPDeblob();
|
||||||
CheckDatabaseConvertCorpseDeblob();
|
CheckDatabaseConvertCorpseDeblob();
|
||||||
|
|
||||||
/* Fetch Automatic Database Upgrade Script */
|
/* Fetch Automatic Upgrade Script */
|
||||||
if (!std::ifstream("db_update.pl")){
|
if (!std::ifstream("eqemu_update.pl")){
|
||||||
std::cout << "Pulling down automatic database upgrade script...\n" << std::endl;
|
std::cout << "Pulling down automatic database upgrade script..." << 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/eqemu_update.pl'); if ($response->is_success){ open(FILE, '> eqemu_update.pl'); print FILE $response->decoded_content; close(FILE); }\"");
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Automatic Database Upgrade Script
|
Automatic (Database) Upgrade Script
|
||||||
Script: db_update.pl V 1 - the number that world passes to the script will
|
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
|
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
|
eqemu_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 standalone will bring up a menu prompt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* 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 2");
|
system("perl eqemu_update.pl V 2");
|
||||||
|
|
||||||
/* Run Automatic Database Upgrade Script */
|
/* Run Automatic Database Upgrade Script */
|
||||||
system("perl db_update.pl ran_from_world");
|
system("perl eqemu_update.pl ran_from_world");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,26 +1,31 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
#::: Automatic Database Upgrade Script
|
#::: Automatic (Database) Upgrade Script
|
||||||
#::: Author: Akkadius
|
#::: Author: Akkadius
|
||||||
#::: Purpose: To upgrade databases with ease and maintain versioning
|
#::: Purpose: To upgrade databases with ease and maintain versioning
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
$menu_displayed = 0;
|
$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...
|
#::: 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[0] eq "V"){
|
||||||
if($ARGV[1] > $current_version){
|
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 " Current version: " . $current_version . "\n";
|
||||||
print " New version: " . $current_version . "\n";
|
print " New version: " . $ARGV[1] . "\n";
|
||||||
GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl", "db_update.pl");
|
GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/eqemu_update.pl", "eqemu_update.pl");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
print "No update necessary \n";
|
print "[Upgrade Script] No script update necessary \n";
|
||||||
}
|
}
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -47,15 +52,10 @@ while(<F>) {
|
|||||||
|
|
||||||
$console_output =
|
$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"){
|
if($OS eq "Windows"){
|
||||||
$has_mysql_path = `echo %PATH%`;
|
$has_mysql_path = `echo %PATH%`;
|
||||||
if($has_mysql_path=~/MySQL|MariaDB/i){
|
if($has_mysql_path=~/MySQL|MariaDB/i){
|
||||||
Loading…
x
Reference in New Issue
Block a user