mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
Bring back DBG_USER
(old debug method), fixed bugsnag handler (#1701)
* Rollback some changes
* Updated
* Updated
* Updated
* Update SqlDb.php
* Updated
* Update Ajax.php
* Update Redis.php
* Update Redis.php
* Update Memcached.php
* Update File.php
* Updated
* Updated
* Update CHANGELOG.md
* Update Sqlite.php
* Update SqlDb.php
* Update common.php
* Update Dev.php
* Update config.php
* Update User.php
* Update defines.php
* Updated
* Update User.php
* Update User.php
* Update User.php
* Update User.php
* Update config.php
* Update Dev.php
* Updated
* Update Dev.php
* Update Dev.php
* Update SqlDb.php
* Revert "Update SqlDb.php"
This reverts commit d7c05d85ec
.
* Update Dev.php
* Update Dev.php
* Update Dev.php
* Update Dev.php
* Update CHANGELOG.md
This commit is contained in:
parent
83b465ddd2
commit
f71deed544
23 changed files with 160 additions and 141 deletions
|
@ -1,5 +1,4 @@
|
||||||
# Common params
|
# Common params
|
||||||
APP_ENV=local
|
|
||||||
APP_CRON_ENABLED=true
|
APP_CRON_ENABLED=true
|
||||||
APP_DEMO_MODE=false
|
APP_DEMO_MODE=false
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
- Show torrent unregister action in log actions [\#1696](https://github.com/torrentpier/torrentpier/pull/1696) ([belomaxorka](https://github.com/belomaxorka))
|
- Show torrent unregister action in log actions [\#1696](https://github.com/torrentpier/torrentpier/pull/1696) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Show torrent status changes in actions log [\#1688](https://github.com/torrentpier/torrentpier/pull/1688) ([belomaxorka](https://github.com/belomaxorka))
|
- Show torrent status changes in actions log [\#1688](https://github.com/torrentpier/torrentpier/pull/1688) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Show torrent type (gold / silver) changes in actions log [\#1689](https://github.com/torrentpier/torrentpier/pull/1689) ([belomaxorka](https://github.com/belomaxorka))
|
- Show torrent type (gold / silver) changes in actions log [\#1689](https://github.com/torrentpier/torrentpier/pull/1689) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
- Bring back `DBG_USER` (old debug method), fixed bugsnag handler [\#1701](https://github.com/torrentpier/torrentpier/pull/1701) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Merged some fixes from `new-attachments` branch [\#1700](https://github.com/torrentpier/torrentpier/pull/1700) ([belomaxorka](https://github.com/belomaxorka))
|
- Merged some fixes from `new-attachments` branch [\#1700](https://github.com/torrentpier/torrentpier/pull/1700) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Changed database encoding to `utf8mb4_unicode_ci` [\#1684](https://github.com/torrentpier/torrentpier/pull/1684) ([belomaxorka](https://github.com/belomaxorka))
|
- Changed database encoding to `utf8mb4_unicode_ci` [\#1684](https://github.com/torrentpier/torrentpier/pull/1684) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
|
- Demo mode: Save user language in cookies [\#1584](https://github.com/torrentpier/torrentpier/pull/1584) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
|
|
|
@ -89,7 +89,8 @@ if (is_file(BB_PATH . '/library/config.local.php')) {
|
||||||
/**
|
/**
|
||||||
* Error reporting
|
* Error reporting
|
||||||
*/
|
*/
|
||||||
$debug = new \TorrentPier\Dev();
|
define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
|
||||||
|
(new \TorrentPier\Dev());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server variables initialize
|
* Server variables initialize
|
||||||
|
|
|
@ -484,6 +484,10 @@ $bb_cfg['telegram_sender'] = [
|
||||||
];
|
];
|
||||||
|
|
||||||
// Special users
|
// Special users
|
||||||
|
$bb_cfg['dbg_users'] = [
|
||||||
|
// Syntax: 'user_id' => 'username'
|
||||||
|
2 => 'admin',
|
||||||
|
];
|
||||||
$bb_cfg['unlimited_users'] = [
|
$bb_cfg['unlimited_users'] = [
|
||||||
// Syntax: 'user_id' => 'username'
|
// Syntax: 'user_id' => 'username'
|
||||||
2 => 'admin',
|
2 => 'admin',
|
||||||
|
|
|
@ -35,6 +35,7 @@ define('UPDATER_FILE', INT_DATA_DIR . '/updater.json');
|
||||||
define('API_IP_URL', 'https://freeipapi.com/api/json/');
|
define('API_IP_URL', 'https://freeipapi.com/api/json/');
|
||||||
define('CHECKSUMS_FILE', INT_DATA_DIR . '/checksums.md5');
|
define('CHECKSUMS_FILE', INT_DATA_DIR . '/checksums.md5');
|
||||||
define('RESTORE_CORRUPT_CONFIRM_FILE', INT_DATA_DIR . '/rescorrupt.integrity');
|
define('RESTORE_CORRUPT_CONFIRM_FILE', INT_DATA_DIR . '/rescorrupt.integrity');
|
||||||
|
define('COOKIE_DBG', 'bb_dbg');
|
||||||
|
|
||||||
// Templates
|
// Templates
|
||||||
define('ADMIN_TPL_DIR', TEMPLATES_DIR . '/admin/');
|
define('ADMIN_TPL_DIR', TEMPLATES_DIR . '/admin/');
|
||||||
|
@ -68,6 +69,8 @@ define('LOG_MAX_SIZE', 1048576); // bytes
|
||||||
|
|
||||||
// Error reporting
|
// Error reporting
|
||||||
ini_set('error_reporting', E_ALL); // PHP error reporting mode | https://www.php.net/manual/en/errorfunc.constants.php
|
ini_set('error_reporting', E_ALL); // PHP error reporting mode | https://www.php.net/manual/en/errorfunc.constants.php
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
define('MYSQLI_ERROR_REPORTING', MYSQLI_REPORT_ERROR); // MySQL error reporting mode | https://www.php.net/manual/mysqli-driver.report-mode.php
|
define('MYSQLI_ERROR_REPORTING', MYSQLI_REPORT_ERROR); // MySQL error reporting mode | https://www.php.net/manual/mysqli-driver.report-mode.php
|
||||||
ini_set('log_errors', 1); // Enable logging (For native & Whoops)
|
ini_set('log_errors', 1); // Enable logging (For native & Whoops)
|
||||||
ini_set('error_log', LOG_DIR . '/php_errors.log'); // path to log file enabled only if log_errors == 1 (native)
|
ini_set('error_log', LOG_DIR . '/php_errors.log'); // path to log file enabled only if log_errors == 1 (native)
|
||||||
|
|
|
@ -11,7 +11,7 @@ if (!defined('BB_ROOT')) {
|
||||||
die(basename(__FILE__));
|
die(basename(__FILE__));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $bb_cfg, $debug, $userdata, $template, $DBS, $lang;
|
global $bb_cfg, $userdata, $template, $DBS, $lang;
|
||||||
|
|
||||||
if (!empty($template)) {
|
if (!empty($template)) {
|
||||||
$template->assign_vars([
|
$template->assign_vars([
|
||||||
|
@ -25,7 +25,7 @@ if (!empty($template)) {
|
||||||
$template->pparse('page_footer');
|
$template->pparse('page_footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
$show_dbg_info = (!$debug->isProduction && !(isset($_GET['pane']) && $_GET['pane'] == 'left'));
|
$show_dbg_info = (DBG_USER && !(isset($_GET['pane']) && $_GET['pane'] == 'left'));
|
||||||
|
|
||||||
if (!$bb_cfg['gzip_compress']) {
|
if (!$bb_cfg['gzip_compress']) {
|
||||||
flush();
|
flush();
|
||||||
|
|
|
@ -71,7 +71,7 @@ if (!empty($_COOKIE['explain'])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_log = !empty($_COOKIE['sql_log']) ? $debug->getSqlLog() : false;
|
$sql_log = !empty($_COOKIE['sql_log']) ? \TorrentPier\Dev::getSqlLog() : false;
|
||||||
|
|
||||||
if ($sql_log) {
|
if ($sql_log) {
|
||||||
echo '<div class="sqlLog" id="sqlLog">' . $sql_log . '</div><!-- / sqlLog --><br clear="all" />';
|
echo '<div class="sqlLog" id="sqlLog">' . $sql_log . '</div><!-- / sqlLog --><br clear="all" />';
|
||||||
|
|
13
src/Ajax.php
13
src/Ajax.php
|
@ -174,11 +174,10 @@ class Ajax
|
||||||
*/
|
*/
|
||||||
public function send(): void
|
public function send(): void
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
$this->response['action'] = $this->action;
|
$this->response['action'] = $this->action;
|
||||||
|
|
||||||
if ($debug->sqlDebugAllowed()) {
|
if (Dev::sqlDebugAllowed()) {
|
||||||
$this->response['sql_log'] = $debug->getSqlLog();
|
$this->response['sql_log'] = Dev::getSqlLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
// sending output will be handled by $this->ob_handler()
|
// sending output will be handled by $this->ob_handler()
|
||||||
|
@ -194,12 +193,8 @@ class Ajax
|
||||||
*/
|
*/
|
||||||
public function ob_handler($contents): string
|
public function ob_handler($contents): string
|
||||||
{
|
{
|
||||||
global $debug;
|
if (DBG_USER && $contents) {
|
||||||
|
$this->response['raw_output'] = $contents;
|
||||||
if (!$debug->isProduction) {
|
|
||||||
if ($contents) {
|
|
||||||
$this->response['raw_output'] = $contents;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$response_js = json_encode($this->response, JSON_THROW_ON_ERROR);
|
$response_js = json_encode($this->response, JSON_THROW_ON_ERROR);
|
||||||
|
|
152
src/Dev.php
152
src/Dev.php
|
@ -10,7 +10,6 @@
|
||||||
namespace TorrentPier;
|
namespace TorrentPier;
|
||||||
|
|
||||||
use Bugsnag\Client;
|
use Bugsnag\Client;
|
||||||
use Bugsnag\Handler;
|
|
||||||
|
|
||||||
use Monolog\Formatter\LineFormatter;
|
use Monolog\Formatter\LineFormatter;
|
||||||
use Monolog\Handler\BrowserConsoleHandler;
|
use Monolog\Handler\BrowserConsoleHandler;
|
||||||
|
@ -32,20 +31,6 @@ use Exception;
|
||||||
*/
|
*/
|
||||||
class Dev
|
class Dev
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Environment type
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private string $envType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* In production mode
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public bool $isProduction = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whoops instance
|
* Whoops instance
|
||||||
*
|
*
|
||||||
|
@ -58,33 +43,22 @@ class Dev
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->envType = strtolower(env('APP_ENV', 'production'));
|
|
||||||
$this->whoops = new Run;
|
$this->whoops = new Run;
|
||||||
|
|
||||||
switch ($this->envType) {
|
if (DBG_USER) {
|
||||||
case 'prod':
|
$this->getWhoopsOnPage();
|
||||||
case 'production':
|
} else {
|
||||||
ini_set('display_errors', 0);
|
$this->getWhoopsPlaceholder();
|
||||||
ini_set('display_startup_errors', 0);
|
|
||||||
$this->getWhoopsProduction();
|
|
||||||
$this->isProduction = true;
|
|
||||||
break;
|
|
||||||
case 'dev':
|
|
||||||
case 'local':
|
|
||||||
case 'development':
|
|
||||||
ini_set('display_errors', 1);
|
|
||||||
ini_set('display_startup_errors', 1);
|
|
||||||
$this->getWhoops();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
$this->getBugsnag();
|
$this->getWhoopsLogger();
|
||||||
$this->getTelegramSender();
|
$this->getTelegramSender();
|
||||||
|
$this->getBugsnag();
|
||||||
|
|
||||||
$this->whoops->register();
|
$this->whoops->register();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bugsnag debug driver
|
* [Whoops] Bugsnag handler
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -96,11 +70,14 @@ class Dev
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Handler::register(Client::make($bb_cfg['bugsnag']['api_key']));
|
$bugsnag = Client::make($bb_cfg['bugsnag']['api_key']);
|
||||||
|
$this->whoops->pushHandler(function ($e) use ($bugsnag) {
|
||||||
|
$bugsnag->notifyException($e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Telegram debug driver
|
* [Whoops] Telegram handler
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
@ -108,37 +85,26 @@ class Dev
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
global $bb_cfg;
|
||||||
|
|
||||||
if ($bb_cfg['telegram_sender']['enabled']) {
|
if (!$bb_cfg['telegram_sender']['enabled']) {
|
||||||
$telegramSender = new PlainTextHandler();
|
return;
|
||||||
$telegramSender->loggerOnly(true);
|
|
||||||
$telegramSender->setLogger((new Logger(
|
|
||||||
APP_NAME,
|
|
||||||
[(new TelegramHandler($bb_cfg['telegram_sender']['token'], (int)$bb_cfg['telegram_sender']['chat_id'], timeout: (int)$bb_cfg['telegram_sender']['timeout']))
|
|
||||||
->setFormatter(new TelegramFormatter())]
|
|
||||||
)));
|
|
||||||
$this->whoops->pushHandler($telegramSender);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$telegramSender = new PlainTextHandler();
|
||||||
|
$telegramSender->loggerOnly(true);
|
||||||
|
$telegramSender->setLogger((new Logger(
|
||||||
|
APP_NAME,
|
||||||
|
[(new TelegramHandler($bb_cfg['telegram_sender']['token'], (int)$bb_cfg['telegram_sender']['chat_id'], timeout: (int)$bb_cfg['telegram_sender']['timeout']))
|
||||||
|
->setFormatter(new TelegramFormatter())]
|
||||||
|
)));
|
||||||
|
$this->whoops->pushHandler($telegramSender);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whoops production debug driver
|
* [Whoops] On page handler (in debug)
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function getWhoopsProduction(): void
|
private function getWhoopsOnPage(): void
|
||||||
{
|
|
||||||
$this->whoops->pushHandler(function () {
|
|
||||||
global $bb_cfg;
|
|
||||||
echo $bb_cfg['whoops']['error_message'];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whoops debug driver
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function getWhoops(): void
|
|
||||||
{
|
{
|
||||||
global $bb_cfg;
|
global $bb_cfg;
|
||||||
|
|
||||||
|
@ -164,20 +130,42 @@ class Dev
|
||||||
->setFormatter((new LineFormatter(null, null, true)))]
|
->setFormatter((new LineFormatter(null, null, true)))]
|
||||||
)));
|
)));
|
||||||
$this->whoops->pushHandler($loggingInConsole);
|
$this->whoops->pushHandler($loggingInConsole);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log errors in file
|
* [Whoops] Logger handler
|
||||||
*/
|
*
|
||||||
if ((int)ini_get('log_errors') === 1) {
|
* @return void
|
||||||
$loggingInFile = new PlainTextHandler();
|
*/
|
||||||
$loggingInFile->loggerOnly(true);
|
private function getWhoopsLogger(): void
|
||||||
$loggingInFile->setLogger((new Logger(
|
{
|
||||||
APP_NAME,
|
if ((int)ini_get('log_errors') !== 1) {
|
||||||
[(new StreamHandler(WHOOPS_LOG_FILE))
|
return;
|
||||||
->setFormatter((new LineFormatter(null, null, true)))]
|
|
||||||
)));
|
|
||||||
$this->whoops->pushHandler($loggingInFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$loggingInFile = new PlainTextHandler();
|
||||||
|
$loggingInFile->loggerOnly(true);
|
||||||
|
$loggingInFile->setLogger((new Logger(
|
||||||
|
APP_NAME,
|
||||||
|
[(new StreamHandler(WHOOPS_LOG_FILE))
|
||||||
|
->setFormatter((new LineFormatter(null, null, true)))]
|
||||||
|
)));
|
||||||
|
$this->whoops->pushHandler($loggingInFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [Whoops] Placeholder handler (non debug)
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function getWhoopsPlaceholder(): void
|
||||||
|
{
|
||||||
|
global $bb_cfg;
|
||||||
|
|
||||||
|
$this->whoops->pushHandler(function ($e) use ($bb_cfg) {
|
||||||
|
echo $bb_cfg['whoops']['error_message'];
|
||||||
|
echo "<hr>Error: {$e->getMessage()}.";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -186,28 +174,28 @@ class Dev
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getSqlLog(): string
|
public static function getSqlLog(): string
|
||||||
{
|
{
|
||||||
global $DBS, $CACHES, $datastore;
|
global $DBS, $CACHES, $datastore;
|
||||||
|
|
||||||
$log = '';
|
$log = '';
|
||||||
|
|
||||||
foreach ($DBS->srv as $srv_name => $db_obj) {
|
foreach ($DBS->srv as $srv_name => $db_obj) {
|
||||||
$log .= !empty($db_obj->dbg) ? $this->getSqlLogHtml($db_obj, "database: $srv_name [{$db_obj->engine}]") : '';
|
$log .= !empty($db_obj->dbg) ? self::getSqlLogHtml($db_obj, "database: $srv_name [{$db_obj->engine}]") : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($CACHES->obj as $cache_name => $cache_obj) {
|
foreach ($CACHES->obj as $cache_name => $cache_obj) {
|
||||||
if (!empty($cache_obj->db->dbg)) {
|
if (!empty($cache_obj->db->dbg)) {
|
||||||
$log .= $this->getSqlLogHtml($cache_obj->db, "cache: $cache_name [{$cache_obj->db->engine}]");
|
$log .= self::getSqlLogHtml($cache_obj->db, "cache: $cache_name [{$cache_obj->db->engine}]");
|
||||||
} elseif (!empty($cache_obj->dbg)) {
|
} elseif (!empty($cache_obj->dbg)) {
|
||||||
$log .= $this->getSqlLogHtml($cache_obj, "cache: $cache_name [{$cache_obj->engine}]");
|
$log .= self::getSqlLogHtml($cache_obj, "cache: $cache_name [{$cache_obj->engine}]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($datastore->db->dbg)) {
|
if (!empty($datastore->db->dbg)) {
|
||||||
$log .= $this->getSqlLogHtml($datastore->db, "cache: datastore [{$datastore->db->engine}]");
|
$log .= self::getSqlLogHtml($datastore->db, "cache: datastore [{$datastore->db->engine}]");
|
||||||
} elseif (!empty($datastore->dbg)) {
|
} elseif (!empty($datastore->dbg)) {
|
||||||
$log .= $this->getSqlLogHtml($datastore, "cache: datastore [{$datastore->engine}]");
|
$log .= self::getSqlLogHtml($datastore, "cache: datastore [{$datastore->engine}]");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $log;
|
return $log;
|
||||||
|
@ -218,9 +206,9 @@ class Dev
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function sqlDebugAllowed(): bool
|
public static function sqlDebugAllowed(): bool
|
||||||
{
|
{
|
||||||
return (SQL_DEBUG && !$this->isProduction && !empty($_COOKIE['sql_log']));
|
return (SQL_DEBUG && DBG_USER && !empty($_COOKIE['sql_log']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -232,13 +220,13 @@ class Dev
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getSqlLogHtml(object $db_obj, string $log_name): string
|
private static function getSqlLogHtml(object $db_obj, string $log_name): string
|
||||||
{
|
{
|
||||||
$log = '';
|
$log = '';
|
||||||
|
|
||||||
foreach ($db_obj->dbg as $i => $dbg) {
|
foreach ($db_obj->dbg as $i => $dbg) {
|
||||||
$id = "sql_{$i}_" . random_int(0, mt_getrandmax());
|
$id = "sql_{$i}_" . random_int(0, mt_getrandmax());
|
||||||
$sql = $this->shortQuery($dbg['sql'], true);
|
$sql = self::shortQuery($dbg['sql'], true);
|
||||||
$time = sprintf('%.4f', $dbg['time']);
|
$time = sprintf('%.4f', $dbg['time']);
|
||||||
$perc = '[' . round($dbg['time'] * 100 / $db_obj->sql_timetotal) . '%]';
|
$perc = '[' . round($dbg['time'] * 100 / $db_obj->sql_timetotal) . '%]';
|
||||||
$info = !empty($dbg['info']) ? $dbg['info'] . ' [' . $dbg['src'] . ']' : $dbg['src'];
|
$info = !empty($dbg['info']) ? $dbg['info'] . ' [' . $dbg['src'] . ']' : $dbg['src'];
|
||||||
|
@ -261,7 +249,7 @@ class Dev
|
||||||
* @param bool $esc_html
|
* @param bool $esc_html
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function shortQuery(string $sql, bool $esc_html = false): string
|
public static function shortQuery(string $sql, bool $esc_html = false): string
|
||||||
{
|
{
|
||||||
$max_len = 100;
|
$max_len = 100;
|
||||||
$sql = str_compact($sql);
|
$sql = str_compact($sql);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Cache;
|
namespace TorrentPier\Legacy\Cache;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use MatthiasMullie\Scrapbook\Adapters\Apc;
|
use MatthiasMullie\Scrapbook\Adapters\Apc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,11 +54,9 @@ class APCu extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(string $prefix)
|
public function __construct(string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$this->apcu = new Apc();
|
$this->apcu = new Apc();
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Cache;
|
namespace TorrentPier\Legacy\Cache;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Common
|
* Class Common
|
||||||
* @package TorrentPier\Legacy\Cache
|
* @package TorrentPier\Legacy\Cache
|
||||||
|
@ -70,8 +72,6 @@ class Common
|
||||||
|
|
||||||
public function debug($mode, $cur_query = null)
|
public function debug($mode, $cur_query = null)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
if (!$this->dbg_enabled) {
|
if (!$this->dbg_enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ class Common
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'start':
|
case 'start':
|
||||||
$this->sql_starttime = utime();
|
$this->sql_starttime = utime();
|
||||||
$dbg['sql'] = $debug->shortQuery($cur_query ?? $this->cur_query);
|
$dbg['sql'] = Dev::shortQuery($cur_query ?? $this->cur_query);
|
||||||
$dbg['src'] = $this->debug_find_source();
|
$dbg['src'] = $this->debug_find_source();
|
||||||
$dbg['file'] = $this->debug_find_source('file');
|
$dbg['file'] = $this->debug_find_source('file');
|
||||||
$dbg['line'] = $this->debug_find_source('line');
|
$dbg['line'] = $this->debug_find_source('line');
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Cache;
|
namespace TorrentPier\Legacy\Cache;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
use League\Flysystem\Local\LocalFilesystemAdapter;
|
use League\Flysystem\Local\LocalFilesystemAdapter;
|
||||||
use MatthiasMullie\Scrapbook\Adapters\Flysystem;
|
use MatthiasMullie\Scrapbook\Adapters\Flysystem;
|
||||||
|
@ -55,13 +57,11 @@ class File extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(string $dir, string $prefix)
|
public function __construct(string $dir, string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$adapter = new LocalFilesystemAdapter($dir, null, LOCK_EX);
|
$adapter = new LocalFilesystemAdapter($dir, null, LOCK_EX);
|
||||||
$filesystem = new Filesystem($adapter);
|
$filesystem = new Filesystem($adapter);
|
||||||
$this->file = new Flysystem($filesystem);
|
$this->file = new Flysystem($filesystem);
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Cache;
|
namespace TorrentPier\Legacy\Cache;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use Memcached as MemcachedClient;
|
use Memcached as MemcachedClient;
|
||||||
use MatthiasMullie\Scrapbook\Adapters\Memcached as MemcachedCache;
|
use MatthiasMullie\Scrapbook\Adapters\Memcached as MemcachedCache;
|
||||||
|
|
||||||
|
@ -75,12 +77,10 @@ class Memcached extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(array $cfg, string $prefix)
|
public function __construct(array $cfg, string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$this->client = new MemcachedClient();
|
$this->client = new MemcachedClient();
|
||||||
$this->cfg = $cfg;
|
$this->cfg = $cfg;
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Cache;
|
namespace TorrentPier\Legacy\Cache;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use Redis as RedisClient;
|
use Redis as RedisClient;
|
||||||
use MatthiasMullie\Scrapbook\Adapters\Redis as RedisCache;
|
use MatthiasMullie\Scrapbook\Adapters\Redis as RedisCache;
|
||||||
|
|
||||||
|
@ -75,12 +77,10 @@ class Redis extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(array $cfg, string $prefix)
|
public function __construct(array $cfg, string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$this->client = new RedisClient();
|
$this->client = new RedisClient();
|
||||||
$this->cfg = $cfg;
|
$this->cfg = $cfg;
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Cache;
|
namespace TorrentPier\Legacy\Cache;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use MatthiasMullie\Scrapbook\Adapters\SQLite as SQLiteCache;
|
use MatthiasMullie\Scrapbook\Adapters\SQLite as SQLiteCache;
|
||||||
use PDO;
|
use PDO;
|
||||||
|
|
||||||
|
@ -54,12 +56,10 @@ class Sqlite extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(string $dir, string $prefix)
|
public function __construct(string $dir, string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$client = new PDO("sqlite:$dir.db");
|
$client = new PDO("sqlite:$dir.db");
|
||||||
$this->sqlite = new SQLiteCache($client);
|
$this->sqlite = new SQLiteCache($client);
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -463,8 +463,22 @@ class User
|
||||||
*/
|
*/
|
||||||
public function set_session_cookies($user_id)
|
public function set_session_cookies($user_id)
|
||||||
{
|
{
|
||||||
|
global $bb_cfg;
|
||||||
|
|
||||||
|
$debug_cookies = [
|
||||||
|
COOKIE_DBG,
|
||||||
|
'explain',
|
||||||
|
'sql_log',
|
||||||
|
'sql_log_full'
|
||||||
|
];
|
||||||
|
|
||||||
if ($user_id == GUEST_UID) {
|
if ($user_id == GUEST_UID) {
|
||||||
$delete_cookies = [COOKIE_DATA, 'torhelp', 'user_lang'];
|
$delete_cookies = [
|
||||||
|
COOKIE_DATA,
|
||||||
|
'torhelp',
|
||||||
|
'user_lang'
|
||||||
|
];
|
||||||
|
$delete_cookies = array_merge($delete_cookies, $debug_cookies);
|
||||||
|
|
||||||
foreach ($delete_cookies as $cookie) {
|
foreach ($delete_cookies as $cookie) {
|
||||||
if (isset($_COOKIE[$cookie])) {
|
if (isset($_COOKIE[$cookie])) {
|
||||||
|
@ -472,6 +486,22 @@ class User
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (!isset($bb_cfg['dbg_users'][$this->data['user_id']]) && DBG_USER) {
|
||||||
|
bb_setcookie(COOKIE_DBG, null);
|
||||||
|
} elseif (isset($bb_cfg['dbg_users'][$this->data['user_id']]) && !DBG_USER) {
|
||||||
|
bb_setcookie(COOKIE_DBG, hash('xxh128', $bb_cfg['dbg_users'][$this->data['user_id']]), COOKIE_SESSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unset sql debug cookies if SQL_DEBUG is disabled or DBG_USER cookie not present
|
||||||
|
if (!SQL_DEBUG || !DBG_USER) {
|
||||||
|
foreach ($debug_cookies as $cookie) {
|
||||||
|
if (isset($_COOKIE[$cookie])) {
|
||||||
|
bb_setcookie($cookie, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set bb_data (session) cookie
|
||||||
$c_sdata_resv = !empty($_COOKIE[COOKIE_DATA]) ? $_COOKIE[COOKIE_DATA] : null;
|
$c_sdata_resv = !empty($_COOKIE[COOKIE_DATA]) ? $_COOKIE[COOKIE_DATA] : null;
|
||||||
$c_sdata_curr = ($this->sessiondata) ? json_encode($this->sessiondata) : '';
|
$c_sdata_curr = ($this->sessiondata) ? json_encode($this->sessiondata) : '';
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Datastore;
|
namespace TorrentPier\Legacy\Datastore;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use MatthiasMullie\Scrapbook\Adapters\Apc;
|
use MatthiasMullie\Scrapbook\Adapters\Apc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,11 +47,9 @@ class APCu extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(string $prefix)
|
public function __construct(string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$this->apcu = new Apc();
|
$this->apcu = new Apc();
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Datastore;
|
namespace TorrentPier\Legacy\Datastore;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Common
|
* Class Common
|
||||||
* @package TorrentPier\Legacy\Datastore
|
* @package TorrentPier\Legacy\Datastore
|
||||||
|
@ -155,8 +157,6 @@ class Common
|
||||||
|
|
||||||
public function debug($mode, $cur_query = null)
|
public function debug($mode, $cur_query = null)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
if (!$this->dbg_enabled) {
|
if (!$this->dbg_enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ class Common
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'start':
|
case 'start':
|
||||||
$this->sql_starttime = utime();
|
$this->sql_starttime = utime();
|
||||||
$dbg['sql'] = $debug->shortQuery($cur_query ?? $this->cur_query);
|
$dbg['sql'] = Dev::shortQuery($cur_query ?? $this->cur_query);
|
||||||
$dbg['src'] = $this->debug_find_source();
|
$dbg['src'] = $this->debug_find_source();
|
||||||
$dbg['file'] = $this->debug_find_source('file');
|
$dbg['file'] = $this->debug_find_source('file');
|
||||||
$dbg['line'] = $this->debug_find_source('line');
|
$dbg['line'] = $this->debug_find_source('line');
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Datastore;
|
namespace TorrentPier\Legacy\Datastore;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use League\Flysystem\Filesystem;
|
use League\Flysystem\Filesystem;
|
||||||
use League\Flysystem\Local\LocalFilesystemAdapter;
|
use League\Flysystem\Local\LocalFilesystemAdapter;
|
||||||
use MatthiasMullie\Scrapbook\Adapters\Flysystem;
|
use MatthiasMullie\Scrapbook\Adapters\Flysystem;
|
||||||
|
@ -48,13 +50,11 @@ class File extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(string $dir, string $prefix)
|
public function __construct(string $dir, string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$adapter = new LocalFilesystemAdapter($dir, null, LOCK_EX);
|
$adapter = new LocalFilesystemAdapter($dir, null, LOCK_EX);
|
||||||
$filesystem = new Filesystem($adapter);
|
$filesystem = new Filesystem($adapter);
|
||||||
$this->file = new Flysystem($filesystem);
|
$this->file = new Flysystem($filesystem);
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Datastore;
|
namespace TorrentPier\Legacy\Datastore;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use Memcached as MemcachedClient;
|
use Memcached as MemcachedClient;
|
||||||
use MatthiasMullie\Scrapbook\Adapters\Memcached as MemcachedCache;
|
use MatthiasMullie\Scrapbook\Adapters\Memcached as MemcachedCache;
|
||||||
|
|
||||||
|
@ -68,12 +70,10 @@ class Memcached extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(array $cfg, string $prefix)
|
public function __construct(array $cfg, string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$this->client = new MemcachedClient();
|
$this->client = new MemcachedClient();
|
||||||
$this->cfg = $cfg;
|
$this->cfg = $cfg;
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Datastore;
|
namespace TorrentPier\Legacy\Datastore;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use Redis as RedisClient;
|
use Redis as RedisClient;
|
||||||
use MatthiasMullie\Scrapbook\Adapters\Redis as RedisCache;
|
use MatthiasMullie\Scrapbook\Adapters\Redis as RedisCache;
|
||||||
|
|
||||||
|
@ -68,12 +70,10 @@ class Redis extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(array $cfg, string $prefix)
|
public function __construct(array $cfg, string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$this->client = new RedisClient();
|
$this->client = new RedisClient();
|
||||||
$this->cfg = $cfg;
|
$this->cfg = $cfg;
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
namespace TorrentPier\Legacy\Datastore;
|
namespace TorrentPier\Legacy\Datastore;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
use MatthiasMullie\Scrapbook\Adapters\SQLite as SQLiteCache;
|
use MatthiasMullie\Scrapbook\Adapters\SQLite as SQLiteCache;
|
||||||
use PDO;
|
use PDO;
|
||||||
|
|
||||||
|
@ -47,12 +49,10 @@ class Sqlite extends Common
|
||||||
*/
|
*/
|
||||||
public function __construct(string $dir, string $prefix)
|
public function __construct(string $dir, string $prefix)
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$client = new PDO("sqlite:$dir.db");
|
$client = new PDO("sqlite:$dir.db");
|
||||||
$this->sqlite = new SQLiteCache($client);
|
$this->sqlite = new SQLiteCache($client);
|
||||||
$this->prefix = $prefix;
|
$this->prefix = $prefix;
|
||||||
$this->dbg_enabled = $debug->sqlDebugAllowed();
|
$this->dbg_enabled = Dev::sqlDebugAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,6 +11,8 @@ namespace TorrentPier\Legacy;
|
||||||
|
|
||||||
use mysqli_result;
|
use mysqli_result;
|
||||||
|
|
||||||
|
use TorrentPier\Dev;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SqlDb
|
* Class SqlDb
|
||||||
* @package TorrentPier\Legacy
|
* @package TorrentPier\Legacy
|
||||||
|
@ -55,10 +57,10 @@ class SqlDb
|
||||||
*/
|
*/
|
||||||
public function __construct($cfg_values)
|
public function __construct($cfg_values)
|
||||||
{
|
{
|
||||||
global $DBS, $debug;
|
global $DBS;
|
||||||
|
|
||||||
$this->cfg = array_combine($this->cfg_keys, $cfg_values);
|
$this->cfg = array_combine($this->cfg_keys, $cfg_values);
|
||||||
$this->dbg_enabled = ($debug->sqlDebugAllowed() || !empty($_COOKIE['explain']));
|
$this->dbg_enabled = (Dev::sqlDebugAllowed() || !empty($_COOKIE['explain']));
|
||||||
$this->do_explain = ($this->dbg_enabled && !empty($_COOKIE['explain']));
|
$this->do_explain = ($this->dbg_enabled && !empty($_COOKIE['explain']));
|
||||||
$this->slow_time = SQL_SLOW_QUERY_TIME;
|
$this->slow_time = SQL_SLOW_QUERY_TIME;
|
||||||
|
|
||||||
|
@ -830,8 +832,6 @@ class SqlDb
|
||||||
*/
|
*/
|
||||||
public function log_query($log_file = 'sql_queries')
|
public function log_query($log_file = 'sql_queries')
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$q_time = ($this->cur_query_time >= 10) ? round($this->cur_query_time, 0) : sprintf('%.4f', $this->cur_query_time);
|
$q_time = ($this->cur_query_time >= 10) ? round($this->cur_query_time, 0) : sprintf('%.4f', $this->cur_query_time);
|
||||||
$msg = [];
|
$msg = [];
|
||||||
$msg[] = round($this->sql_starttime);
|
$msg[] = round($this->sql_starttime);
|
||||||
|
@ -839,7 +839,7 @@ class SqlDb
|
||||||
$msg[] = sprintf('%-6s', $q_time);
|
$msg[] = sprintf('%-6s', $q_time);
|
||||||
$msg[] = sprintf('%05d', getmypid());
|
$msg[] = sprintf('%05d', getmypid());
|
||||||
$msg[] = $this->db_server;
|
$msg[] = $this->db_server;
|
||||||
$msg[] = $debug->shortQuery($this->cur_query);
|
$msg[] = Dev::shortQuery($this->cur_query);
|
||||||
$msg = implode(LOG_SEPR, $msg);
|
$msg = implode(LOG_SEPR, $msg);
|
||||||
$msg .= ($info = $this->query_info()) ? ' # ' . $info : '';
|
$msg .= ($info = $this->query_info()) ? ' # ' . $info : '';
|
||||||
$msg .= ' # ' . $this->debug_find_source() . ' ';
|
$msg .= ' # ' . $this->debug_find_source() . ' ';
|
||||||
|
@ -903,8 +903,6 @@ class SqlDb
|
||||||
*/
|
*/
|
||||||
public function explain($mode, $html_table = '', array $row = [])
|
public function explain($mode, $html_table = '', array $row = [])
|
||||||
{
|
{
|
||||||
global $debug;
|
|
||||||
|
|
||||||
$query = str_compact($this->cur_query);
|
$query = str_compact($this->cur_query);
|
||||||
// remove comments
|
// remove comments
|
||||||
$query = preg_replace('#(\s*)(/\*)(.*)(\*/)(\s*)#', '', $query);
|
$query = preg_replace('#(\s*)(/\*)(.*)(\*/)(\s*)#', '', $query);
|
||||||
|
@ -950,7 +948,7 @@ class SqlDb
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan="2">' . $this->explain_hold . '</td></tr>
|
<tr><td colspan="2">' . $this->explain_hold . '</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="sqlLog"><div id="' . $htid . '" class="sqlLogRow sqlExplain" style="padding: 0;">' . $debug->shortQuery($dbg['sql'], true) . ' </div></div>
|
<div class="sqlLog"><div id="' . $htid . '" class="sqlLogRow sqlExplain" style="padding: 0;">' . Dev::shortQuery($dbg['sql'], true) . ' </div></div>
|
||||||
<br />';
|
<br />';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue