Minor improvements (#321)

* Minor improvements

* Update config.php

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-10-15 23:45:58 +07:00 committed by GitHub
parent f336022de8
commit 178592ebb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 24 deletions

View File

@ -10,7 +10,7 @@
- Release v2.1.5-2023.10 🎉
- Updated utf8 & reflection type hint classes [\#320](https://github.com/torrentpier/torrentpier-lts/pull/320) ([belomaxorka](https://github.com/belomaxorka))
- Updated Text_LangCorrect class [\#309](https://github.com/torrentpier/torrentpier-lts/pull/309) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#297](https://github.com/torrentpier/torrentpier-lts/pull/297), [\#298](https://github.com/torrentpier/torrentpier-lts/pull/298), [\#300](https://github.com/torrentpier/torrentpier-lts/pull/300), [\#301](https://github.com/torrentpier/torrentpier-lts/pull/301), [\#302](https://github.com/torrentpier/torrentpier-lts/pull/302), [\#303](https://github.com/torrentpier/torrentpier-lts/pull/303), [\#305](https://github.com/torrentpier/torrentpier-lts/pull/305), [\#306](https://github.com/torrentpier/torrentpier-lts/pull/306), [\#307](https://github.com/torrentpier/torrentpier-lts/pull/307), [\#310](https://github.com/torrentpier/torrentpier-lts/pull/310), [\#312](https://github.com/torrentpier/torrentpier-lts/pull/312), [\#313](https://github.com/torrentpier/torrentpier-lts/pull/313), [\#315](https://github.com/torrentpier/torrentpier-lts/pull/315), [\#316](https://github.com/torrentpier/torrentpier-lts/pull/316), [\#317](https://github.com/torrentpier/torrentpier-lts/pull/317), [\#319](https://github.com/torrentpier/torrentpier-lts/pull/319) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#297](https://github.com/torrentpier/torrentpier-lts/pull/297), [\#298](https://github.com/torrentpier/torrentpier-lts/pull/298), [\#300](https://github.com/torrentpier/torrentpier-lts/pull/300), [\#301](https://github.com/torrentpier/torrentpier-lts/pull/301), [\#302](https://github.com/torrentpier/torrentpier-lts/pull/302), [\#303](https://github.com/torrentpier/torrentpier-lts/pull/303), [\#305](https://github.com/torrentpier/torrentpier-lts/pull/305), [\#306](https://github.com/torrentpier/torrentpier-lts/pull/306), [\#307](https://github.com/torrentpier/torrentpier-lts/pull/307), [\#310](https://github.com/torrentpier/torrentpier-lts/pull/310), [\#312](https://github.com/torrentpier/torrentpier-lts/pull/312), [\#313](https://github.com/torrentpier/torrentpier-lts/pull/313), [\#315](https://github.com/torrentpier/torrentpier-lts/pull/315), [\#316](https://github.com/torrentpier/torrentpier-lts/pull/316), [\#317](https://github.com/torrentpier/torrentpier-lts/pull/317), [\#319](https://github.com/torrentpier/torrentpier-lts/pull/319), [\#321](https://github.com/torrentpier/torrentpier-lts/pull/321) ([belomaxorka](https://github.com/belomaxorka))
## [v2.1.5-2023.09](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.09) (2023-10-04)
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.08-HotFix...v2.1.5-2023.09)

View File

@ -13,7 +13,7 @@ if (empty($_SERVER['HTTP_USER_AGENT']))
// Ignore 'completed' event
if (isset($_GET['event']) && $_GET['event'] === 'completed')
{
if (DBG_LOG) dbg_log(' ', '!die-event-completed');
if (DBG_LOG_TRACKER) dbg_log(' ', '!die-event-completed');
dummy_exit(mt_rand(600, 1200));
}
@ -144,7 +144,7 @@ $peer_hash = md5(
// Get cached peer info from previous announce (last peer info)
$lp_info = CACHE('tr_cache')->get(PEER_HASH_PREFIX . $peer_hash);
if (DBG_LOG) dbg_log(' ', '$lp_info-get_from-CACHE-'. ($lp_info ? 'hit' : 'miss'));
if (DBG_LOG_TRACKER) dbg_log(' ', '$lp_info-get_from-CACHE-'. ($lp_info ? 'hit' : 'miss'));
// Drop fast announce
if ($lp_info && (!isset($event) || $event !== 'stopped'))
@ -169,7 +169,7 @@ function drop_fast_announce ($lp_info)
function msg_die ($msg)
{
if (DBG_LOG) dbg_log(' ', '!die-'. clean_filename($msg));
if (DBG_LOG_TRACKER) dbg_log(' ', '!die-'. clean_filename($msg));
$output = bencode(array(
# 'interval' => (int) 1800,
@ -196,7 +196,7 @@ $stopped = ($event === 'stopped');
if ($stopped)
{
CACHE('tr_cache')->rm(PEER_HASH_PREFIX . $peer_hash);
if (DBG_LOG) dbg_log(' ', 'stopped');
if (DBG_LOG_TRACKER) dbg_log(' ', 'stopped');
}
// Get last peer info from DB
@ -206,7 +206,7 @@ if (!CACHE('tr_cache')->used && !$lp_info)
SELECT * FROM ". BB_BT_TRACKER ." WHERE peer_hash = '$peer_hash' LIMIT 1
");
if (DBG_LOG) dbg_log(' ', '$lp_info-get_from-DB-'. ($lp_info ? 'hit' : 'miss'));
if (DBG_LOG_TRACKER) dbg_log(' ', '$lp_info-get_from-DB-'. ($lp_info ? 'hit' : 'miss'));
}
if ($lp_info)
@ -399,7 +399,7 @@ if ($lp_info)
$peer_info_updated = DB()->affected_rows();
if (DBG_LOG) dbg_log(' ', 'this_peer-update'. ($peer_info_updated ? '' : '-FAIL'));
if (DBG_LOG_TRACKER) dbg_log(' ', 'this_peer-update'. ($peer_info_updated ? '' : '-FAIL'));
}
if (!$lp_info || !$peer_info_updated)
@ -409,7 +409,7 @@ if (!$lp_info || !$peer_info_updated)
DB()->query("REPLACE INTO ". BB_BT_TRACKER ." ($columns) VALUES ($values)");
if (DBG_LOG) dbg_log(' ', 'this_peer-insert');
if (DBG_LOG_TRACKER) dbg_log(' ', 'this_peer-insert');
}
// Exit if stopped
@ -432,12 +432,12 @@ $lp_info = array(
$lp_info_cached = CACHE('tr_cache')->set(PEER_HASH_PREFIX . $peer_hash, $lp_info, PEER_HASH_EXPIRE);
if (DBG_LOG && !$lp_info_cached) dbg_log(' ', '$lp_info-caching-FAIL');
if (DBG_LOG_TRACKER && !$lp_info_cached) dbg_log(' ', '$lp_info-caching-FAIL');
// Get cached output
$output = CACHE('tr_cache')->get(PEERS_LIST_PREFIX . $topic_id);
if (DBG_LOG) dbg_log(' ', '$output-get_from-CACHE-'. ($output !== false ? 'hit' : 'miss'));
if (DBG_LOG_TRACKER) dbg_log(' ', '$output-get_from-CACHE-'. ($output !== false ? 'hit' : 'miss'));
if (!$output)
{
@ -501,7 +501,7 @@ if (!$output)
$peers_list_cached = CACHE('tr_cache')->set(PEERS_LIST_PREFIX . $topic_id, $output, PEERS_LIST_EXPIRE);
if (DBG_LOG && !$peers_list_cached) dbg_log(' ', '$output-caching-FAIL');
if (DBG_LOG_TRACKER && !$peers_list_cached) dbg_log(' ', '$output-caching-FAIL');
}
// Return data to client

View File

@ -12,7 +12,7 @@ function tracker_exit ()
{
global $DBS;
if (DBG_LOG && DBG_TRACKER)
if (DBG_LOG_TRACKER)
{
if ($gen_time = utime() - TIMESTART)
{
@ -42,7 +42,7 @@ function silent_exit ()
function error_exit ($msg = '')
{
if (DBG_LOG) dbg_log(' ', '!err-'. clean_filename($msg));
if (DBG_LOG_TRACKER) dbg_log(' ', '!err-'. clean_filename($msg));
silent_exit();
@ -138,7 +138,7 @@ class sql_db
$this->debug('end');
$this->cur_query = null;
# if (DBG_LOG) dbg_log(' ', 'DB-connect'. ($link ? '' : '-FAIL'));
# if (DBG_LOG_TRACKER) dbg_log(' ', 'DB-connect'. ($link ? '' : '-FAIL'));
if (!$link)
{
@ -353,7 +353,7 @@ class sql_db
$this->link = $this->selected_db = null;
if (DBG_LOG) dbg_log(str_repeat(' ', $this->num_queries), 'DB-num_queries-'. php_sapi_name());
if (DBG_LOG_TRACKER) dbg_log(str_repeat(' ', $this->num_queries), 'DB-num_queries-'. php_sapi_name());
}
/**
@ -389,7 +389,7 @@ class sql_db
if ($mode == 'start')
{
if (SQL_CALC_QUERY_TIME || DBG_LOG || SQL_LOG_SLOW_QUERIES)
if (SQL_CALC_QUERY_TIME || DBG_LOG_TRACKER || SQL_LOG_SLOW_QUERIES)
{
$this->sql_starttime = utime();
$this->sql_last_time = 0;
@ -397,7 +397,7 @@ class sql_db
}
elseif ($mode == 'end')
{
if (SQL_CALC_QUERY_TIME || DBG_LOG || SQL_LOG_SLOW_QUERIES)
if (SQL_CALC_QUERY_TIME || DBG_LOG_TRACKER || SQL_LOG_SLOW_QUERIES)
{
$this->sql_last_time = utime() - $this->sql_starttime;
$this->sql_timetotal += $this->sql_last_time;
@ -421,13 +421,11 @@ class sql_db
/**
* Trigger error
*/
function trigger_error ($msg = '')
function trigger_error ($msg = 'DB Error')
{
if (error_reporting())
{
if (!$msg) $msg = 'DB Error';
if (DBG_TRACKER === true)
if (DBG_LOG_TRACKER === true)
{
$err = $this->sql_error();
$msg .= trim(sprintf(' #%06d %s', $err['code'], $err['message']));

View File

@ -21,7 +21,7 @@ $info_hash = $_GET['info_hash'];
function msg_die ($msg)
{
if (DBG_LOG) dbg_log(' ', '!die-'. clean_filename($msg));
if (DBG_LOG_TRACKER) dbg_log(' ', '!die-'. clean_filename($msg));
$output = bencode(array(
'min interval' => (int) 1800,

View File

@ -321,8 +321,8 @@ $bb_cfg['adv_email'] = "adv@$domain_name"; // почта для
define('SPHINX_LOG_ERRORS', true); // логировать ошибки Sphinx
define('SPHINX_LOG_NAME', 'sphinx_errors'); // имя файла с логами Sphinx
define('DBG_LOG', false); // включить логирование событий движка (отключите на боевом сервере)
define('DBG_TRACKER', false); // включить логирование событий анонсера (отключите на боевом сервере)
define('DBG_LOG', true); // включить логирование событий движка (отключите на боевом сервере)
define('DBG_LOG_TRACKER', false); // включить логирование событий анонсера (отключите на боевом сервере)
define('COOKIE_DBG', 'bb_dbg'); // debug cookie name
define('SQL_DEBUG', true); // включить отладку для SQL запросов и Cache & Datastore
define('SQL_BB_LOG_NAME', 'sql_error_bb'); // имя лог файла с SQL ошибками (Форум)