mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 05:13:54 -07:00
Minor improvements (#889)
This commit is contained in:
parent
10b56ecdef
commit
339f0ef948
8 changed files with 24 additions and 22 deletions
|
@ -163,6 +163,7 @@ require __DIR__ . '/includes/init_tr.php';
|
|||
|
||||
$seeder = ($left == 0) ? 1 : 0;
|
||||
$stopped = ($event === 'stopped');
|
||||
$completed = ($event === 'completed');
|
||||
|
||||
// Stopped event
|
||||
if ($stopped) {
|
||||
|
@ -397,8 +398,7 @@ if (!$output) {
|
|||
}
|
||||
}
|
||||
|
||||
$seeders = 0;
|
||||
$leechers = 0;
|
||||
$seeders = $leechers = 0;
|
||||
|
||||
if ($bb_cfg['tracker']['scrape']) {
|
||||
$row = DB()->fetch_row("
|
||||
|
|
|
@ -103,7 +103,6 @@ define('BB_BT_TRACKER_SNAP', 'bb_bt_tracker_snap');
|
|||
define('BB_BT_USERS', 'bb_bt_users');
|
||||
|
||||
define('BT_AUTH_KEY_LENGTH', 10);
|
||||
|
||||
define('PEER_HASH_PREFIX', 'peer_');
|
||||
define('PEERS_LIST_PREFIX', 'peers_list_');
|
||||
define('PEER_HASH_EXPIRE', round($bb_cfg['announce_interval'] * (0.85 * $bb_cfg['tracker']['expire_factor']))); // sec
|
||||
|
|
|
@ -232,7 +232,7 @@ if ($tor_reged && $tor_info) {
|
|||
|
||||
'TOR_SIZE' => humn_size($tor_size),
|
||||
'TOR_LONGEVITY' => delta_time($tor_info['reg_time']),
|
||||
'TOR_COMPLETED' => declension($tor_info['complete_count'], 'times'),
|
||||
'TOR_COMPLETED' => declension((int)$tor_info['complete_count'], 'times'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ $bb_cfg['cache'] = [
|
|||
'redis' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'pconnect' => true,
|
||||
'con_required' => true,
|
||||
],
|
||||
// Available cache types: filecache, memcache, sqlite, redis, apcu (filecache by default)
|
||||
|
|
|
@ -27,7 +27,7 @@ class Memcache extends Common
|
|||
public function __construct($cfg, $prefix = null)
|
||||
{
|
||||
if (!$this->is_installed()) {
|
||||
die('Error: Memcached extension not installed');
|
||||
die("Error: $this->engine extension not installed");
|
||||
}
|
||||
|
||||
$this->cfg = $cfg;
|
||||
|
@ -48,7 +48,7 @@ class Memcache extends Common
|
|||
}
|
||||
|
||||
if (!$this->connected && $this->cfg['con_required']) {
|
||||
die('Could not connect to memcached server');
|
||||
die("Could not connect to $this->engine server");
|
||||
}
|
||||
|
||||
$this->debug('stop');
|
||||
|
|
|
@ -27,7 +27,7 @@ class Redis extends Common
|
|||
public function __construct($cfg, $prefix = null)
|
||||
{
|
||||
if (!$this->is_installed()) {
|
||||
die('Error: Redis extension not installed');
|
||||
die("Error: $this->engine extension not installed");
|
||||
}
|
||||
|
||||
$this->cfg = $cfg;
|
||||
|
@ -38,15 +38,17 @@ class Redis extends Common
|
|||
|
||||
public function connect()
|
||||
{
|
||||
$this->cur_query = 'connect ' . $this->cfg['host'] . ':' . $this->cfg['port'];
|
||||
$connect_type = ($this->cfg['pconnect']) ? 'pconnect' : 'connect';
|
||||
|
||||
$this->cur_query = $connect_type . ' ' . $this->cfg['host'] . ':' . $this->cfg['port'];
|
||||
$this->debug('start');
|
||||
|
||||
if (@$this->redis->connect($this->cfg['host'], $this->cfg['port'])) {
|
||||
if (@$this->redis->$connect_type($this->cfg['host'], $this->cfg['port'])) {
|
||||
$this->connected = true;
|
||||
}
|
||||
|
||||
if (!$this->connected && $this->cfg['con_required']) {
|
||||
die('Could not connect to redis server');
|
||||
die("Could not connect to $this->engine server");
|
||||
}
|
||||
|
||||
$this->debug('stop');
|
||||
|
|
|
@ -26,7 +26,7 @@ class Memcache extends Common
|
|||
public function __construct($cfg, $prefix = null)
|
||||
{
|
||||
if (!$this->is_installed()) {
|
||||
die('Error: Memcached extension not installed');
|
||||
die("Error: $this->engine extension not installed");
|
||||
}
|
||||
|
||||
$this->cfg = $cfg;
|
||||
|
@ -47,7 +47,7 @@ class Memcache extends Common
|
|||
}
|
||||
|
||||
if (!$this->connected && $this->cfg['con_required']) {
|
||||
die('Could not connect to memcached server');
|
||||
die("Could not connect to $this->engine server");
|
||||
}
|
||||
|
||||
$this->debug('stop');
|
||||
|
|
|
@ -26,7 +26,7 @@ class Redis extends Common
|
|||
public function __construct($cfg, $prefix = null)
|
||||
{
|
||||
if (!$this->is_installed()) {
|
||||
die('Error: Redis extension not installed');
|
||||
die("Error: $this->engine extension not installed");
|
||||
}
|
||||
|
||||
$this->cfg = $cfg;
|
||||
|
@ -45,7 +45,7 @@ class Redis extends Common
|
|||
}
|
||||
|
||||
if (!$this->connected && $this->cfg['con_required']) {
|
||||
die('Could not connect to redis server');
|
||||
die("Could not connect to $this->engine server");
|
||||
}
|
||||
|
||||
$this->debug('stop');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue