- Added Perl based conf merger script

- Removed LogSQL config option until reimplementation on code side
- A bit of cosmetics for .conf files

--HG--
branch : trunk
This commit is contained in:
leak committed 2010-12-06 00:24:45 +01:00
1 parent 59c1a238f5
commit e226c4ac34
4 files changed
+62 -21

No files matched your search

+8 -1
View File
@@ -1,6 +1,13 @@
This is a PHP script for merging a new .dist file with your existing .conf file (trinitycore and trinityrealm)
==== PHP merger (index.php + merge.php) ====
This is a PHP script for merging a new .dist file with your existing .conf file (worldserver.conf.dist and authserver.conf.dist)
It should also work with mangos dist/conf files as well.
It uses sessions so it is multi user safe, it adds any options that are removed to the bottom of the file,
commented out, just in case it removes something it shouldn't,
and, if you add all of your custom patch configs below "# Custom" they will be copied exactly as they are.
==== Perl merger (tc-conf-merger.pl) ====
Perl based command line merger script. This script feeds a .conf.dist file with variables that exist in an old .conf file,
comments and custom options are ignored.
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/perl -w
# Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
# Author: leak
# Date: 2010-12-06
# Note: Based on conf file format of rev 10507
use strict;
if (@ARGV != 3)
{
print("Usage:\ntc-conf-merger.pl <path to new .conf.dist> <path to old .conf> <path to output .conf>\n");
exit(1);
}
if (! -e $ARGV[0])
{
print("No file found at: ".$ARGV[0]);
exit(1);
}
elsif (! -e $ARGV[1])
{
print("No file found at: ".$ARGV[1]);
exit(1);
}
open CONFDIST, "<", $ARGV[0] or die "Error: Could not open ".$ARGV[0]."\n";
my $confdist = join "", <CONFDIST>;
close CONFDIST;
open CONFOLD, "<", $ARGV[1] or die "Error: Could not open ".$ARGV[1]."\n";
my $confold = join "", <CONFOLD>;
close CONFOLD;
while ($confold =~ m/^(?!#)(.*?)\s+?=\s+?(.*?)$/mg) {
my $key = $1, my $value = $2;
$confdist =~ s/^(\Q$key\E)(\s+?=\s+?)(.*)/$1$2$value/mg;
}
open OUTPUT, ">", $ARGV[2] or die "Error: Could not open ".$ARGV[2]."\n";
binmode(OUTPUT);
print OUTPUT $confdist;
close OUTPUT;