moves mysql config to separate file

This commit is contained in:
Mateusz Zawisza 2012-08-18 01:36:10 +02:00 committed by Johannes Dewender
parent f148f3bf10
commit 41ebe20498
3 changed files with 34 additions and 30 deletions

View File

@ -406,10 +406,11 @@ function setupMySQL()
// we need to locate tracker.mysql.php // we need to locate tracker.mysql.php
// first, try the most obvious location.. which should be in the // first, try the most obvious location.. which should be in the
// same directory as the ./help.php file being ran // same directory as the ./help.php file being ran
if (is_readable('./tracker.mysql.php')) if (is_readable('./mysql/tracker.mysql.php'))
{ {
// require // require
require './tracker.mysql.php'; require './mysql/tracker.mysql.php';
require './mysql.config.php';
} }
// unfortunately, it does not seem the file is located in the current // unfortunately, it does not seem the file is located in the current
// directory, we will recurse the paths below and attempt to locate it // directory, we will recurse the paths below and attempt to locate it
@ -669,4 +670,4 @@ utilMySQL();
</table> </table>
</div> </div>
</body> </body>
</html> </html>

29
mysql.config.php Normal file
View File

@ -0,0 +1,29 @@
<?php
$_SERVER['tracker'] = array(
// general tracker options
'open_tracker' => true, /* track anything announced to it */
'announce_interval' => 1800, /* how often client will send requests */
'min_interval' => 900, /* how often client can force requests */
'default_peers' => 50, /* default # of peers to announce */
'max_peers' => 100, /* max # of peers to announce */
// advanced tracker options
'external_ip' => true, /* allow client to specify ip address */
'force_compact' => false, /* force compact announces only */
'full_scrape' => false, /* allow scrapes without info_hash */
'random_limit' => 500, /* if peers > #, use alternate SQL RAND() */
'clean_idle_peers' => 10, /* tweaks % of time tracker attempts idle peer removal */
/* if you have a busy tracker, you may adjust this */
/* example: 10 = 10%, 20 = 5%, 50 = 2%, 100 = 1% */
// database options
'db_host' => 'localhost', /* ip or hostname to mysql server */
'db_user' => 'root', /* username used to connect to mysql */
'db_pass' => '', /* password used to connect to mysql */
'db_name' => 'peertracker', /* name of the PeerTracker database */
// advanced database options
'db_prefix' => 'pt_', /* name prefixes for the PeerTracker tables */
'db_persist' => false, /* use persistent connections if available. */
);
?>

View File

@ -24,33 +24,7 @@
// Configuration /////////////////////////////////////////////////////////////////////////////////// // Configuration ///////////////////////////////////////////////////////////////////////////////////
// tracker state // tracker state
$_SERVER['tracker'] = array( require('../mysql.config.php')
// general tracker options
'open_tracker' => true, /* track anything announced to it */
'announce_interval' => 1800, /* how often client will send requests */
'min_interval' => 900, /* how often client can force requests */
'default_peers' => 50, /* default # of peers to announce */
'max_peers' => 100, /* max # of peers to announce */
// advanced tracker options
'external_ip' => true, /* allow client to specify ip address */
'force_compact' => false, /* force compact announces only */
'full_scrape' => false, /* allow scrapes without info_hash */
'random_limit' => 500, /* if peers > #, use alternate SQL RAND() */
'clean_idle_peers' => 10, /* tweaks % of time tracker attempts idle peer removal */
/* if you have a busy tracker, you may adjust this */
/* example: 10 = 10%, 20 = 5%, 50 = 2%, 100 = 1% */
// database options
'db_host' => 'localhost', /* ip or hostname to mysql server */
'db_user' => 'root', /* username used to connect to mysql */
'db_pass' => '', /* password used to connect to mysql */
'db_name' => 'peertracker', /* name of the PeerTracker database */
// advanced database options
'db_prefix' => 'pt_', /* name prefixes for the PeerTracker tables */
'db_persist' => false, /* use persistent connections if available. */
);
// Tracker Operations ////////////////////////////////////////////////////////////////////////////// // Tracker Operations //////////////////////////////////////////////////////////////////////////////
// fatal error, stop execution // fatal error, stop execution