The Unreal Admins Page - Forums

The Unreal Admins Page - Forums (https://unrealadmin.org/forums/index.php)
-   General Chat (https://unrealadmin.org/forums/forumdisplay.php?f=174)
-   -   Automating UTStats import with mutator (https://unrealadmin.org/forums/showthread.php?t=11521)

+++crowbar+++ 9th July, 2005 12:14 PM

Automating UTStats import with mutator
 
Hi folks!

If you dont have access to cron jobs on your webserver and you're sick of manually updating your UTSTATS through the IMPORT menu option?

Well, here'S a little server actor, that may help ;-)

Your UTSTATS-installation *MUST* be configured for ftp-import.

How it works:
The URI when updating your UTStats through the IMPORT option is something like this:
http://www.yourwebserver.com/utstats...p?key=password

Since UT-server has the abillity to browse to websites, like in the News tab when searching for UT-servers, the mutator is simply querying the URI to the import.php-script of your UTStats installation and the import.php script starts uploading the stats from the UT-server to your UTStats-server. Thats all folks.

Download here:
UTStats-Trigger v1.0 Read the readme.txt !!!

Though mutator is working fine on my server, the early development stage can still hold some surprises, of course. When you face problems using this mutator simply e-mail me.

text [email address]

The UTStats team or anybody else can use the code in your projects. No copyright, no licence, no GPL-bullshit. This is absolutly FREE software. Use at own will and risk.


Cheers!
+++crowbar+++

Azazel 9th July, 2005 06:47 AM

Nice work :)

^D@rk^SwaT 9th July, 2005 06:48 AM

nice work mang :)

SixtSense 9th July, 2005 08:12 AM

I think you made a lot of people happy that dont have full acces to there server
great Job!

PizzaMan 9th July, 2005 08:39 AM

Nice :)

Saves me the countless emails from webcron.org saying that I have to delete my history to re-enable the job.

Adrian[ADIES] 10th July, 2005 02:57 AM

Automating imports
 
That looks good.

I automated the stats import by adding
"<meta http-equiv="refresh" content="600">"
at the end of "import.php" and leaving the webpage open on my server.

So now it updates every 10min and I have had no problems for 2months. :mrgreen:

+++crowbar+++ 10th July, 2005 04:16 PM

Okay, never wanted to publish this one, but you may like it.

Before I got the idea to code that little mutator, I coded a little Windows application, that periodically queried the import.php-script of my UTStats server. It's a tray application, that opens hidden. So you may not need to have an open browser window on your server anymore...

Source code is provided too. Dont blame me on my coding style... hehe.

Download here:
PingUTStats_v1.0.zip

Read the ReadMe.txt !!!

Cheers!
+++crowbar+++

Adrian[ADIES] 11th July, 2005 02:03 PM

wow +++crowbar+++ thats perfect for me, I can even run it as a service.
your the man :mrgreen:

Azazel 12th July, 2005 11:06 AM

Stickied :)

DonvanVliet 25th July, 2005 03:01 AM

The Trigger mutator appears in the mutatorlist on the ServerAdmin page. I allways thought that was not happening with ServerActors.
It doesn't work for me anyway. Keeps giving errors in my log.

PizzaMan 25th July, 2005 08:57 AM

Quote:

Originally Posted by DonvanVliet
The Trigger mutator appears in the mutatorlist

It doesnt appear in my list.

+++crowbar+++ 25th July, 2005 09:25 AM

Remove the file "UTSTATS_Trigger.int". Server actors should not need this file. Can you please post me what errors occur with the actor?

Greetings
+++crowbar+++

DonvanVliet 26th July, 2005 05:29 PM

Why is there an .int file in the first place?

+++crowbar+++ 26th July, 2005 06:01 PM

The int-file is by accident in the package, but dont worry. The int file is not the source of any errors.

DonvanVliet 26th July, 2005 06:04 PM

I am going to test it again tomorrow because it's a bit busy on our server now, and if there are any errors I post them here.

Mulsiphix 2nd August, 2005 02:24 PM

Quote:

Your UTSTATS-installation *MUST* be configured for ftp-import.
How do I know if it is set to ftp-import? I went over the utstat documentation and I could not find anything called ftp-import. Please explain.

Also will this work if I am hosting the dedicated server on my computer? That is I don't have any ftp information to give it for retreiving my log files. If it does require an FTP would setting one up on my computer suffice for this purpose?

Azazel 3rd August, 2005 06:26 AM

Most people use ftp to get the logs from the game server to the web server.
UTStats on the web server side has the ability to ftp logs over, so this mutator just invokes that web process.

If you need to move logs over another way you can do that and then still use the mutator as the mutator just loads a page that firstly gets logs via ftp then imports them.

Try looking in includes/config.php for more info on what UTStats can do :)

Mulsiphix 3rd August, 2005 08:16 PM

I cannot seem to get this, downloading logs via ftp and importing them to utstats, to work. I keep getting an error when I try. I am not sure if I have everything setup correctly so I will just lay everything out for you to see. Any feedback would be highly appreciated. lol

The Facts
1. I do not run a dedicated server. I run a server on my LAN and when I am not personally using it with friends it is offline.
2. I've read about the mutator and UTPing in this thread and would like to use both, if they'll work in my case, to automatically upload and import my logs to my installation of utstats.
3. Since the logs are located on my hard drive I have setup an FTP server so that my logs may be retrieved via FTP.
4. With $ftp_use set to false I have successfully imported logs into utstats so I know my database information is correct and functional.
5. I have logged into my ftp utstats account so I know its information is also functional.
6. I am behind a firewall and use a Linksys router. The program I use, GuildFTP Daemon, has always worked for me so I do not think either of these things present an issue.

Questions
1. UTStats-Trigger: Does UT have to be running for my logs to be uploaded and imported? I usually play for an hour or so a day so if this is the case I am not sure it is the way to go.
2. UTPing: Is this of any use if UT is not running? I went ahead and ran it, filled in my info, and clicked on test, but it returned an error.




CONFIG.PHP
Code:

<?
// Database connection details
$dbname = "censored for this post but proven to work 100%";
$hostname = "censored";
$uname = "censored";
$upass = "censored";

$dbconnect = mysql_connect($hostname,$uname,$upass);
$dbconnect2 = mysql_select_db($dbname);

// The key needed to run the import script
$import_adminkey = 'censored';

// When runnning from the command-line (cron jobs):
// The absolute path to UTStats's home directory.
// Only needed if you're starting the importer from another directory
// Leave emtpy if unsure
$import_homedir = '';

// Use the MySQL temporary tables feature?
// Available since MySQL 3.23 - requires CREATE TEMPORARY TABLE privilege since 4.0.2
$import_use_temporary_tables = true;                // set to true if available

// Use temporary heap tables?
// This will (at any cost) keep the entire table in RAM and may speed and/or fuck things up
$import_use_heap_tables = false;                                // DON'T USE IF YOU DON'T KNOW WHAT YOU'RE DOING!

// Log files start with...
$import_log_start = "Unreal.ngLog";

// Log files end with...
$import_log_extension = ".log";

// How to backup logfiles?
// Possible values: yes      - move logfiles to the backup directory
//                  no      - don't make a backup. The file will be lost after it was imported
//                  compress - will compress the logfile and move it to the backup directory
//                            It'll first try bzip2 compression, then gzip (your php must be
//                            compiled to support these)
//                            If both fail, it will backup the uncompressed log
//                  gzip    - same as compress but will only try to gzip the file
$import_log_backup = "gzip";

// Purge old logs after x days. 0 to disable.
$import_log_backups_purge_after = 0;


// After how many seconds should we reload the import page?
// This is to prevent the 'maximum execution time exeeded' error. It will reload
// the page after the amount of seconds you specify in order to bypass php's time limit.
// Set to 0 to disable (f.e. if your php does not run in safe mode)
$import_reload_after = 10;

// Ignore bots and bot kills/deaths?
$import_ignore_bots = false;

// How to deal with banned players?
// 1 - (recommended) import the player and display him/her on matchpages (without values :D)
//    but don't include him/her in rankings and don't allow to show individual player stats
//    You may unban a player banned with this setting and all stuff will display again
// 2 - don't import at all
//    will lead to 'strange' results on matchpages because kills of and against this player
//    won't be shown; efficiency etc. will be calculated including these kills though.
$import_ban_type = 1;

// Try to import logs from previous versions of UTStats
// Set this to true and you'll probably some strange results - You've been warned ;)
$import_incompatible_logs = false;

// Don't import if the gametime was less than x minutes. Set to 0 to import all logs.
$import_ignore_if_gametime_less_than = 0;


// UTStats can download and manage your UTDC logs
// Enable downloading of UTDC logs?
$import_utdc_download_enable = false;

// Log files start with...
$import_utdc_log_start = "[UTDC]";

// Log files end with...
$import_utdc_log_extension = ".log";

// Compress UTDC logfiles after download? [compress/gzip/no]
// (see $import_log_backup for available options)
$import_utdc_log_compress = "compress";

// Purge old UTDC logs after x days. 0 to disable.
$import_utdc_log_purge_after = 0;


// Enable the creation of pictures? (Signature pictures for users where they can see their current ranking and stuff)
// Requires GD- and FreeType support.
// see config_pic.php for picture configuration options
$pic_enable = true;


// FTP Connection Details
$ftp_use = true;                                      // Whether to auto get the log files
$ftp_interval = 0;                                    // How often in minutes to allow stats update
$ftp_type = 'sockets';                                // Which FTP module do you want to use?
                                                                                        // sockets - (recommended)
                                                                                        //          Use PHP's socket extension to connect to the FTP server
                                                                                        //          will fallback to 'pure' if no sockets available
                                                                                        // pure    - Use fsockopen() to connnect to the FTP server
                                                                                        //          should work with any php version
                                                                                        // php    - Use PHP's FTP extension (must be compiled in)
                                                                                        //          Debugging will not be available with this module and
                                                                                        //          error handling may not be as good as with the other modules

$ftp_debug = false;                                        // Debugging output that may help you to resolve ftp problems


// UT Server 1
$i = 0;
$ftp_hostname[$i]        = '67.166.240.114';        // FTP server location here
$ftp_port[$i]                = 48255;                        // FTP Port - do not remove this even if you do not use ftp
                                                                // Do not add '' around the port either
$ftp_uname[$i]        = 'censored';                // FTP Username
$ftp_upass[$i]        = 'censored';            // FTP Password
$ftp_dir[$i][]        = '/Logs';                // Directory of the log files - MUST NOT end with a /
//$ftp_dir[$i][]        = '/';                        // You may repeat this entry as often as you wish but please remember
//$ftp_dir[$i][]        = '/';                        // to enter the directory relative to the last one
//$ftp_dir[$i][]        = '/';                        // (or use an absolute path)
$ftp_passive[$i]        = true;                        // Use passive transfer mode for this connection?
$ftp_delete[$i]        = false;                        // Delete logs after download?

/*
// UT Server 2 --- Uncomment this one if needed, or copy/paste the block above if more servers are needed.
$i++;
$ftp_hostname[$i]        = '';                                // FTP server location here
$ftp_port[$i]                = 21;                                // FTP Port - do not remove this even if you do not use ftp
                                                                                        // Do not add '' around the port either
$ftp_uname[$i]        = '';                                // FTP Username
$ftp_upass[$i]        = '';                                // FTP Password
$ftp_dir[$i][]        = '/';                        // Directory of the log files - MUST NOT end with a /
//$ftp_dir[$i][]        = '/';                        // You may repeat this entry as often as you wish but please remember
//$ftp_dir[$i][]        = '/';                        // to enter the directory relative to the last one
//$ftp_dir[$i][]        = '/';                        // (or use an absolute path)
$ftp_passive[$i]        = true;                        // Use passive transfer mode for this connection?
$ftp_delete[$i]        = true;                        // Delete logs after download?
*/
?>


DonvanVliet 3rd August, 2005 11:41 PM

It says $ftp_dir[$i][] = '/Logs';.

It has to be $ftp_dir[$i][] = 'Logs';.

Try that.

Azazel 4th August, 2005 01:42 PM

You run the server locally and the game locally, why on earth don't you just use windows to copy the logs over (scheduled task/call a batch file).


All times are GMT +1. The time now is 05:50 AM.

 


All pages are copyright The Unreal Admins Page.
You may not copy any pages without our express permission.