mirror of
https://github.com/torrentpier/torrentpier-lts.git
synced 2025-02-28 15:10:54 +03:00
parent
843641c22a
commit
14554da61e
@ -28,7 +28,7 @@
|
||||
- Use constants instead of string literals [\#151](https://github.com/torrentpier/torrentpier-lts/pull/151), [\#160](https://github.com/torrentpier/torrentpier-lts/pull/160) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Sync language (html dir) with latest sources [\#152](https://github.com/torrentpier/torrentpier-lts/pull/152) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Updated UK lang icons [\#155](https://github.com/torrentpier/torrentpier-lts/pull/155) ([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), [\#139](https://github.com/torrentpier/torrentpier-lts/pull/139), [\#142](https://github.com/torrentpier/torrentpier-lts/pull/142), [\#144](https://github.com/torrentpier/torrentpier-lts/pull/144), [\#145](https://github.com/torrentpier/torrentpier-lts/pull/145), [\#148](https://github.com/torrentpier/torrentpier-lts/pull/148), [\#153](https://github.com/torrentpier/torrentpier-lts/pull/153), [\#154](https://github.com/torrentpier/torrentpier-lts/pull/154), [\#156](https://github.com/torrentpier/torrentpier-lts/pull/156), [\#157](https://github.com/torrentpier/torrentpier-lts/pull/157), [\#158](https://github.com/torrentpier/torrentpier-lts/pull/158), [\#159](https://github.com/torrentpier/torrentpier-lts/pull/159), [\#162](https://github.com/torrentpier/torrentpier-lts/pull/162), [\#163](https://github.com/torrentpier/torrentpier-lts/pull/163), [\#164](https://github.com/torrentpier/torrentpier-lts/pull/164), [\#165](https://github.com/torrentpier/torrentpier-lts/pull/165) ([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), [\#139](https://github.com/torrentpier/torrentpier-lts/pull/139), [\#142](https://github.com/torrentpier/torrentpier-lts/pull/142), [\#144](https://github.com/torrentpier/torrentpier-lts/pull/144), [\#145](https://github.com/torrentpier/torrentpier-lts/pull/145), [\#148](https://github.com/torrentpier/torrentpier-lts/pull/148), [\#153](https://github.com/torrentpier/torrentpier-lts/pull/153), [\#154](https://github.com/torrentpier/torrentpier-lts/pull/154), [\#156](https://github.com/torrentpier/torrentpier-lts/pull/156), [\#157](https://github.com/torrentpier/torrentpier-lts/pull/157), [\#158](https://github.com/torrentpier/torrentpier-lts/pull/158), [\#159](https://github.com/torrentpier/torrentpier-lts/pull/159), [\#162](https://github.com/torrentpier/torrentpier-lts/pull/162), [\#163](https://github.com/torrentpier/torrentpier-lts/pull/163), [\#164](https://github.com/torrentpier/torrentpier-lts/pull/164), [\#165](https://github.com/torrentpier/torrentpier-lts/pull/165), [\#166](https://github.com/torrentpier/torrentpier-lts/pull/166) ([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)
|
||||
[Full Changelog](https://github.com/torrentpier/torrentpier-lts/compare/v2.1.5-2023.03...main)
|
||||
|
@ -35,6 +35,8 @@ class sql_db
|
||||
|
||||
var $DBS = array();
|
||||
|
||||
var $engine = 'MySQL';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@ -95,11 +97,12 @@ class sql_db
|
||||
{
|
||||
$server = (DBG_USER) ? $this->cfg['dbhost'] : '';
|
||||
header("HTTP/1.0 503 Service Unavailable");
|
||||
$con_error = "Could not connect to {$this->engine} server $server";
|
||||
if (DBG_USER)
|
||||
{
|
||||
dbg_log("Could not connect to mysql server $server", "{$server}-DB-connect-FAIL_" . time());
|
||||
dbg_log($con_error, "{$server}-DB-connect-FAIL_" . time());
|
||||
}
|
||||
die("Could not connect to mysql server $server");
|
||||
die($con_error);
|
||||
}
|
||||
|
||||
register_shutdown_function(array(&$this, 'close'));
|
||||
@ -911,81 +914,84 @@ class sql_db
|
||||
|
||||
switch ($mode)
|
||||
{
|
||||
case 'start':
|
||||
$this->explain_hold = '';
|
||||
// TODO: добавить поддержку многотабличных запросов
|
||||
if (preg_match('#UPDATE ([a-z0-9_]+).*?WHERE(.*)/#', $query, $m))
|
||||
{
|
||||
$query = "SELECT * FROM $m[1] WHERE $m[2]";
|
||||
}
|
||||
else if (preg_match('#DELETE FROM ([a-z0-9_]+).*?WHERE(.*)#s', $query, $m))
|
||||
{
|
||||
$query = "SELECT * FROM $m[1] WHERE $m[2]";
|
||||
}
|
||||
case 'start':
|
||||
$this->explain_hold = '';
|
||||
// TODO: добавить поддержку многотабличных запросов
|
||||
if (preg_match('#UPDATE ([a-z0-9_]+).*?WHERE(.*)/#', $query, $m))
|
||||
{
|
||||
$query = "SELECT * FROM $m[1] WHERE $m[2]";
|
||||
}
|
||||
else if (preg_match('#DELETE FROM ([a-z0-9_]+).*?WHERE(.*)#s', $query, $m))
|
||||
{
|
||||
$query = "SELECT * FROM $m[1] WHERE $m[2]";
|
||||
}
|
||||
|
||||
if (preg_match('#^SELECT#', $query))
|
||||
{
|
||||
$html_table = false;
|
||||
if (preg_match('#^SELECT#', $query))
|
||||
{
|
||||
$html_table = false;
|
||||
|
||||
if ($result = @mysql_query("EXPLAIN $query", $this->link))
|
||||
{
|
||||
while ($row = @mysql_fetch_assoc($result))
|
||||
{
|
||||
$html_table = $this->explain('add_explain_row', $html_table, $row);
|
||||
}
|
||||
}
|
||||
if ($html_table)
|
||||
{
|
||||
$this->explain_hold .= '</table>';
|
||||
}
|
||||
}
|
||||
break;
|
||||
if ($result = @mysql_query("EXPLAIN $query", $this->link))
|
||||
{
|
||||
while ($row = @mysql_fetch_assoc($result))
|
||||
{
|
||||
$html_table = $this->explain('add_explain_row', $html_table, $row);
|
||||
}
|
||||
}
|
||||
if ($html_table)
|
||||
{
|
||||
$this->explain_hold .= '</table>';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'stop':
|
||||
if (!$this->explain_hold) break;
|
||||
case 'stop':
|
||||
if (!$this->explain_hold) break;
|
||||
|
||||
$id = $this->dbg_id-1;
|
||||
$htid = 'expl-'. intval($this->link) .'-'. $id;
|
||||
$dbg = $this->dbg[$id];
|
||||
$id = $this->dbg_id-1;
|
||||
$htid = 'expl-'. intval($this->link) .'-'. $id;
|
||||
$dbg = $this->dbg[$id];
|
||||
|
||||
$this->explain_out .= '
|
||||
<table width="98%" cellpadding="0" cellspacing="0" class="bodyline row2 bCenter" style="border-bottom: 0px;">
|
||||
<tr>
|
||||
<th style="height: 22px; cursor: pointer;" align="left"> '. $dbg['src'] .' ['. sprintf('%.4f', $dbg['time']) .' s] <i>'. $dbg['info'] .'</i></th>
|
||||
<th style="height: 22px; cursor: pointer;" align="right" title="Copy to clipboard" onclick="$(\'#'. $htid .'\').CopyToClipboard();">'. "$this->db_server.$this->selected_db" .' :: Query #'. ($this->num_queries+1) .' </th>
|
||||
</tr>
|
||||
<tr><td colspan="2">'. $this->explain_hold .'</td></tr>
|
||||
</table>
|
||||
<div class="sqlLog"><div id="'. $htid .'" class="sqlLogRow sqlExplain" style="padding: 0px;">'. short_query($dbg['sql'], true) .' </div></div>
|
||||
<br />';
|
||||
break;
|
||||
$this->explain_out .= '
|
||||
<table width="98%" cellpadding="0" cellspacing="0" class="bodyline row2 bCenter" style="border-bottom: 0px;">
|
||||
<tr>
|
||||
<th style="height: 22px; cursor: pointer;" align="left"> '. $dbg['src'] .' ['. sprintf('%.4f', $dbg['time']) .' s] <i>'. $dbg['info'] .'</i></th>
|
||||
<th style="height: 22px; cursor: pointer;" align="right" title="Copy to clipboard" onclick="$(\'#'. $htid .'\').CopyToClipboard();">'. "[$this->engine] $this->db_server.$this->selected_db" .' :: Query #'. ($this->num_queries+1) .' </th>
|
||||
</tr>
|
||||
<tr><td colspan="2">'. $this->explain_hold .'</td></tr>
|
||||
</table>
|
||||
<div class="sqlLog"><div id="'. $htid .'" class="sqlLogRow sqlExplain" style="padding: 0px;">'. short_query($dbg['sql'], true) .' </div></div>
|
||||
<br />';
|
||||
break;
|
||||
|
||||
case 'add_explain_row':
|
||||
if (!$html_table && $row)
|
||||
{
|
||||
$html_table = true;
|
||||
$this->explain_hold .= '<table width="100%" cellpadding="3" cellspacing="1" class="bodyline" style="border-width: 0;"><tr>';
|
||||
foreach (array_keys($row) as $val)
|
||||
{
|
||||
$this->explain_hold .= '<td class="row3 gensmall" align="center"><b>'. $val .'</b></td>';
|
||||
}
|
||||
$this->explain_hold .= '</tr>';
|
||||
}
|
||||
$this->explain_hold .= '<tr>';
|
||||
foreach (array_values($row) as $i => $val)
|
||||
{
|
||||
$class = !($i % 2) ? 'row1' : 'row2';
|
||||
$this->explain_hold .= '<td class="'. $class .' gen">'. str_replace(array("{$this->selected_db}.", ',', ';'), array('', ', ', ';<br />'), $val) .'</td>';
|
||||
}
|
||||
$this->explain_hold .= '</tr>';
|
||||
case 'add_explain_row':
|
||||
if (!$html_table && $row)
|
||||
{
|
||||
$html_table = true;
|
||||
$this->explain_hold .= '<table width="100%" cellpadding="3" cellspacing="1" class="bodyline" style="border-width: 0;"><tr>';
|
||||
foreach (array_keys($row) as $val)
|
||||
{
|
||||
$this->explain_hold .= '<td class="row3 gensmall" align="center"><b>'. $val .'</b></td>';
|
||||
}
|
||||
$this->explain_hold .= '</tr>';
|
||||
}
|
||||
$this->explain_hold .= '<tr>';
|
||||
foreach (array_values($row) as $i => $val)
|
||||
{
|
||||
$class = !($i % 2) ? 'row1' : 'row2';
|
||||
$this->explain_hold .= '<td class="'. $class .' gen">'. str_replace(array("{$this->selected_db}.", ',', ';'), array('', ', ', ';<br />'), $val) .'</td>';
|
||||
}
|
||||
$this->explain_hold .= '</tr>';
|
||||
|
||||
return $html_table;
|
||||
return $html_table;
|
||||
break;
|
||||
|
||||
break;
|
||||
case 'display':
|
||||
echo '<a name="explain"></a><div class="med">'. $this->explain_out .'</div>';
|
||||
break;
|
||||
|
||||
case 'display':
|
||||
echo '<a name="explain"></a><div class="med">'. $this->explain_out .'</div>';
|
||||
break;
|
||||
default:
|
||||
die("Invalid {$this->engine} explain mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ function get_sql_log ()
|
||||
|
||||
foreach ($DBS->srv as $srv_name => $db_obj)
|
||||
{
|
||||
$log .= !empty($db_obj) ? get_sql_log_html($db_obj, "$srv_name [MySQL]") : '';
|
||||
$log .= !empty($db_obj) ? get_sql_log_html($db_obj, "database: $srv_name [{$db_obj->engine}]") : '';
|
||||
}
|
||||
|
||||
foreach ($CACHES->obj as $cache_name => $cache_obj)
|
||||
|
Loading…
Reference in New Issue
Block a user