Skip to content

Commit

Permalink
Added ability to configure sphinx debug (#137)
Browse files Browse the repository at this point in the history
* Added ability to configure sphinx debug

* Update CHANGELOG.md
  • Loading branch information
belomaxorka committed Apr 6, 2023
1 parent 958dd44 commit 3768fee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Added installed extensions check [\#129](https://github.com/torrentpier/torrentpier-lts/pull/129) ([belomaxorka](https://github.com/belomaxorka))
- Make sql log file name configurable [\#130](https://github.com/torrentpier/torrentpier-lts/pull/130) ([belomaxorka](https://github.com/belomaxorka))
- Enhanced https check [\#131](https://github.com/torrentpier/torrentpier-lts/pull/131), [\#132](https://github.com/torrentpier/torrentpier-lts/pull/132) ([belomaxorka](https://github.com/belomaxorka))
- Added ability to configure sphinx debug [\#137](https://github.com/torrentpier/torrentpier-lts/pull/137) ([belomaxorka](https://github.com/belomaxorka))
- Minor fixes [\#124](https://github.com/torrentpier/torrentpier-lts/pull/124), [\#133](https://github.com/torrentpier/torrentpier-lts/pull/133), [\#135](https://github.com/torrentpier/torrentpier-lts/pull/135), [\#136](https://github.com/torrentpier/torrentpier-lts/pull/136) ([belomaxorka](https://github.com/belomaxorka))

## [v2.1.5-2023.03](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.03) (2023-04-04)
Expand Down
3 changes: 3 additions & 0 deletions library/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@
$bb_cfg['adv_email'] = "adv@$domain_name";

// Debug
define('SPHINX_LOG_ERRORS', true); // log sphinx errors
define('SPHINX_LOG_NAME', 'sphinx_errors'); // sphinx log filename

define('DBG_LOG', false); // enable forum debug (off on production)
define('DBG_TRACKER', false); // enable tracker debug (off on production)
define('COOKIE_DBG', 'bb_dbg'); // debug cookie name
Expand Down
19 changes: 12 additions & 7 deletions library/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2443,15 +2443,20 @@ function init_sphinx ()

function log_sphinx_error ($err_type, $err_msg, $query = '')
{
$ignore_err_txt = array(
'negation on top level',
'Query word length is less than min prefix length',
);
if (!count($ignore_err_txt) || !preg_match('#'. join('|', $ignore_err_txt) .'#i', $err_msg))
if (SPHINX_LOG_ERRORS)
{
$orig_query = strtr($_REQUEST['nm'], array("\n" => '\n'));
bb_log(date('m-d H:i:s') ." | $err_type | $err_msg | $orig_query | $query". LOG_LF, 'sphinx_error');
$ignore_err_txt = array(
'negation on top level',
'Query word length is less than min prefix length',
);
if (!count($ignore_err_txt) || !preg_match('#'. join('|', $ignore_err_txt) .'#i', $err_msg))
{
$orig_query = strtr($_REQUEST['nm'], array("\n" => '\n'));
bb_log(date('m-d H:i:s') ." | $err_type | $err_msg | $orig_query | $query". LOG_LF, SPHINX_LOG_NAME);
}
}

return false;
}

function get_title_match_topics ($title_match_sql, $forum_ids = array())
Expand Down

0 comments on commit 3768fee

Please sign in to comment.