mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
Remove old debug constants
This commit is contained in:
parent
968e25cd6e
commit
6b4d69bcc2
14 changed files with 29 additions and 228 deletions
|
|
@ -42,11 +42,6 @@ if(file_exists(RX_BASEDIR . 'config/config.user.inc.php'))
|
|||
require_once RX_BASEDIR . 'config/config.user.inc.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load legacy debug settings.
|
||||
*/
|
||||
require_once __DIR__ . '/debug.php';
|
||||
|
||||
/**
|
||||
* Define the list of legacy class names for the autoloader.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ define('_XE_PACKAGE_', 'XE');
|
|||
define('_XE_LOCATION_', 'en');
|
||||
define('_XE_LOCATION_SITE_', 'https://www.xpressengine.com/');
|
||||
define('_XE_DOWNLOAD_SERVER_', 'https://download.xpressengine.com/');
|
||||
define('__PROXY_SERVER__', null);
|
||||
define('__DEBUG__', 0);
|
||||
|
||||
/**
|
||||
* Other useful constants.
|
||||
|
|
|
|||
149
common/debug.php
149
common/debug.php
|
|
@ -1,149 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Legacy debug settings for XE Compatibility
|
||||
*
|
||||
* Copyright (c) NAVER <http://www.navercorp.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* output debug message (bit value)
|
||||
*
|
||||
* 0: generate debug messages/not display
|
||||
* 1: display messages through debugPrint() function
|
||||
* 2: output execute time, Request/Response info
|
||||
* 4: output DB query history
|
||||
*/
|
||||
if(!defined('__DEBUG__'))
|
||||
{
|
||||
define('__DEBUG__', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* output location of debug message
|
||||
*
|
||||
* 0: connect to the files/_debug_message.php and output
|
||||
* 1: HTML output as a comment on the bottom (when response method is the HTML)
|
||||
* 2: Firebug console output (PHP 4 & 5. Firebug/FirePHP plug-in required)
|
||||
*/
|
||||
if(!defined('__DEBUG_OUTPUT__'))
|
||||
{
|
||||
define('__DEBUG_OUTPUT__', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* output comments of the firePHP console and browser
|
||||
*
|
||||
* 0: No limit (not recommended)
|
||||
* 1: Allow only specified IP addresses
|
||||
*/
|
||||
if(!defined('__DEBUG_PROTECT__'))
|
||||
{
|
||||
define('__DEBUG_PROTECT__', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a ip address to allow debug
|
||||
*/
|
||||
if(!defined('__DEBUG_PROTECT_IP__'))
|
||||
{
|
||||
define('__DEBUG_PROTECT_IP__', '127.0.0.1');
|
||||
}
|
||||
|
||||
/**
|
||||
* DB error message definition
|
||||
*
|
||||
* 0: No output
|
||||
* 1: files/_debug_db_query.php connected to the output
|
||||
*/
|
||||
if(!defined('__DEBUG_DB_OUTPUT__'))
|
||||
{
|
||||
define('__DEBUG_DB_OUTPUT__', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query log for only timeout query among DB queries
|
||||
*
|
||||
* 0: Do not leave a log
|
||||
* > 0: leave a log when the slow query takes over specified seconds
|
||||
* Log file is saved as ./files/_slowlog_query.php file
|
||||
*/
|
||||
if(!defined('__LOG_SLOW_QUERY__'))
|
||||
{
|
||||
define('__LOG_SLOW_QUERY__', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger excute time log
|
||||
*
|
||||
* 0: Do not leave a log
|
||||
* > 0: leave a log when the trigger takes over specified milliseconds
|
||||
* Log file is saved as ./files/_slowlog_trigger.php
|
||||
*/
|
||||
if(!defined('__LOG_SLOW_TRIGGER__'))
|
||||
{
|
||||
define('__LOG_SLOW_TRIGGER__', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Addon excute time log
|
||||
*
|
||||
* 0: Do not leave a log
|
||||
* > 0: leave a log when the trigger takes over specified milliseconds
|
||||
* Log file is saved as ./files/_slowlog_addon.php
|
||||
*/
|
||||
if(!defined('__LOG_SLOW_ADDON__'))
|
||||
{
|
||||
define('__LOG_SLOW_ADDON__', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget excute time log
|
||||
*
|
||||
* 0: Do not leave a log
|
||||
* > 0: leave a log when the widget takes over specified milliseconds
|
||||
* Log file is saved as ./files/_slowlog_widget.php
|
||||
*/
|
||||
if(!defined('__LOG_SLOW_WIDGET__'))
|
||||
{
|
||||
define('__LOG_SLOW_WIDGET__', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* output comments of the slowlog files
|
||||
*
|
||||
* 0: No limit (not recommended)
|
||||
* 1: Allow only specified IP addresses
|
||||
*/
|
||||
if(!defined('__LOG_SLOW_PROTECT__'))
|
||||
{
|
||||
define('__LOG_SLOW_PROTECT__', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a ip address to allow slowlog
|
||||
*/
|
||||
if(!defined('__LOG_SLOW_PROTECT_IP__'))
|
||||
{
|
||||
define('__LOG_SLOW_PROTECT_IP__', '127.0.0.1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Leave DB query information
|
||||
*
|
||||
* 0: Do not add information to the query
|
||||
* 1: Comment the XML Query ID
|
||||
*/
|
||||
if(!defined('__DEBUG_QUERY__'))
|
||||
{
|
||||
define('__DEBUG_QUERY__', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* __PROXY_SERVER__ has server information to request to the external through the target server
|
||||
* FileHandler:: getRemoteResource uses the constant
|
||||
*/
|
||||
if(!defined('__PROXY_SERVER__'))
|
||||
{
|
||||
define('__PROXY_SERVER__', NULL);
|
||||
}
|
||||
|
|
@ -89,9 +89,9 @@ return array(
|
|||
'enabled' => true,
|
||||
'log_errors' => true,
|
||||
'log_queries' => false,
|
||||
'log_slow_queries' => 1,
|
||||
'log_slow_triggers' => 1,
|
||||
'log_slow_widgets' => 1,
|
||||
'log_slow_queries' => 0,
|
||||
'log_slow_triggers' => 0,
|
||||
'log_slow_widgets' => 0,
|
||||
'display_type' => 'comment',
|
||||
'display_to' => 'admin',
|
||||
'allow' => array(),
|
||||
|
|
|
|||
|
|
@ -216,14 +216,6 @@ class ConfigParser
|
|||
}
|
||||
$config['lock']['allow'] = array_values($db_info->sitelock_whitelist);
|
||||
|
||||
// Convert debug configuration.
|
||||
$config['debug']['enabled'] = true;
|
||||
$config['debug']['log_errors'] = true;
|
||||
$config['debug']['log_queries'] = (\__DEBUG__ & 4) ? true : false;
|
||||
$config['debug']['log_slow_queries'] = floatval(\__LOG_SLOW_QUERY__);
|
||||
$config['debug']['log_slow_triggers'] = floatval(\__LOG_SLOW_TRIGGER__ * 1000);
|
||||
$config['debug']['log_slow_widgets'] = floatval(\__LOG_SLOW_WIDGET__ * 1000);
|
||||
|
||||
// Convert embed filter configuration.
|
||||
if (is_array($db_info->embed_white_iframe))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ $(function() {
|
|||
if (data.queries[i].query_connection) {
|
||||
description += "\n• Caller: " + data.queries[i].file + ":" + data.queries[i].line + " (" + data.queries[i].method + ")";
|
||||
description += "\n• Connection: " + data.queries[i].query_connection;
|
||||
description += "\n• Query ID: " + data.queries[i].query_id;
|
||||
description += "\n• Query Time: " + (data.queries[i].query_time ? (data.queries[i].query_time.toFixed(4) + " sec") : "");
|
||||
}
|
||||
description += "\n• Result: " + ((data.queries[i].message === "success" || !data.queries[i].message) ? "success" : ("error " + data.queries[i].error_code + " " + data.queries[i].message));
|
||||
|
|
|
|||
|
|
@ -712,45 +712,44 @@ function debugPrint($entry = null)
|
|||
*/
|
||||
function writeSlowlog($type, $elapsed_time, $obj)
|
||||
{
|
||||
if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
|
||||
if(__LOG_SLOW_PROTECT__ === 1 && __LOG_SLOW_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) return;
|
||||
static $config = array();
|
||||
if (!$config)
|
||||
{
|
||||
$config = config('debug');
|
||||
}
|
||||
if(!$config['log_slow_queries'] && !$config['log_slow_triggers'] && !$config['log_slow_widgets'])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static $log_filename = array(
|
||||
'query' => 'files/_slowlog_query.php',
|
||||
'trigger' => 'files/_slowlog_trigger.php',
|
||||
'addon' => 'files/_slowlog_addon.php',
|
||||
'widget' => 'files/_slowlog_widget.php'
|
||||
);
|
||||
$log_file = RX_BASEDIR . $log_filename[$type];
|
||||
$write_file = true;
|
||||
|
||||
$log_file = _XE_PATH_ . $log_filename[$type];
|
||||
|
||||
$buff = array();
|
||||
$buff[] = '<?php exit(); ?>';
|
||||
$buff[] = date('c');
|
||||
|
||||
if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
|
||||
if ($type == 'query' && $config['log_slow_queries'] > 0 && $elapsed_time > $config['log_slow_queries'])
|
||||
{
|
||||
$buff[] = "\tCaller : " . $obj->caller;
|
||||
$buff[] = "\tCalled : " . $obj->called;
|
||||
}
|
||||
else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
|
||||
{
|
||||
$buff[] = "\tAddon : " . $obj->called;
|
||||
$buff[] = "\tCalled position : " . $obj->caller;
|
||||
}
|
||||
else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
|
||||
{
|
||||
$buff[] = "\tWidget : " . $obj->called;
|
||||
}
|
||||
else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
|
||||
{
|
||||
|
||||
$buff[] = $obj->query;
|
||||
$buff[] = "\tQuery ID : " . $obj->query_id;
|
||||
$buff[] = "\tCaller : " . $obj->caller;
|
||||
$buff[] = "\tConnection : " . $obj->connection;
|
||||
}
|
||||
elseif ($type == 'trigger' && $config['log_slow_triggers'] > 0 && $elapsed_time > $config['log_slow_triggers'])
|
||||
{
|
||||
$buff[] = "\tCaller : " . $obj->caller;
|
||||
$buff[] = "\tCalled : " . $obj->called;
|
||||
}
|
||||
elseif ($type == 'widget' && $config['log_slow_widgets'] > 0 && $elapsed_time > $config['log_slow_widgets'])
|
||||
{
|
||||
$buff[] = "\tWidget : " . $obj->called;
|
||||
}
|
||||
else
|
||||
{
|
||||
$write_file = false;
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ Query logging is disabled.
|
|||
echo sprintf('%02d. %s', ++$query_count, $query->query_string) . "\n";
|
||||
echo sprintf(' - Caller: %s', $query_caller) . "\n";
|
||||
echo sprintf(' - Connection: %s', $query->query_connection) . "\n";
|
||||
echo sprintf(' - Query ID: %s', $query->query_id) . "\n";
|
||||
echo sprintf(' - Query Time: %0.4f sec', $query->query_time) . "\n";
|
||||
echo sprintf(' - Result: %s', $query_result) . "\n";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue