1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

Merge remote-tracking branch 'EXreaction/ticket/11189' into develop

* EXreaction/ticket/11189:
  [ticket/11189] Replace DEBUG_EXTRA with DEBUG
  [ticket/11189] Always log critical errors when in cron or in image output
This commit is contained in:
Andreas Fischer 2012-11-10 23:39:00 +01:00
commit 847feb07e7
20 changed files with 52 additions and 54 deletions

View File

@ -39,7 +39,7 @@ function do_cron($cron_lock, $run_tasks)
foreach ($run_tasks as $task)
{
if (defined('DEBUG_EXTRA') && $config['use_system_cron'])
if (defined('DEBUG') && $config['use_system_cron'])
{
echo "[phpBB cron] Running task '{$task->get_name()}'\n";
}
@ -57,7 +57,7 @@ function do_cron($cron_lock, $run_tasks)
//
// Attempt to alleviate the problem by doing setup outside of the lock as much as possible.
//
// If DEBUG_EXTRA is defined and cron lock cannot be obtained, a message will be printed.
// If DEBUG is defined and cron lock cannot be obtained, a message will be printed.
if ($config['use_system_cron'])
{
@ -100,7 +100,7 @@ if ($cron_lock->acquire())
}
else
{
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
echo "Could not obtain cron lock.\n";
}

View File

@ -150,7 +150,7 @@ if ($config['gzip_compress'])
}
// IF debug extra is enabled and admin want to "explain" the page we need to set other headers...
if (defined('DEBUG_EXTRA') && request_var('explain', 0) && $auth->acl_get('a_'))
if (defined('DEBUG') && request_var('explain', 0) && $auth->acl_get('a_'))
{
header('Content-type: text/html; charset=UTF-8');
header('Cache-Control: private, no-cache="set-cookie"');

View File

@ -766,8 +766,8 @@ class dbal
// Show complete SQL error and path to administrators only
// Additionally show complete error on installation or if extended debug mode is enabled
// The DEBUG_EXTRA constant is for development only!
if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG_EXTRA'))
// The DEBUG constant is for development only!
if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG'))
{
$message .= ($sql) ? '<br /><br />SQL<br /><br />' . htmlspecialchars($sql) : '';
}

View File

@ -150,7 +150,7 @@ class dbal_firebird extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -251,7 +251,7 @@ class dbal_firebird extends dbal
$this->sql_error($query);
}
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -279,7 +279,7 @@ class dbal_firebird extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -139,7 +139,7 @@ class dbal_mssql extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -154,7 +154,7 @@ class dbal_mssql extends dbal
$this->sql_error($query);
}
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -169,7 +169,7 @@ class dbal_mssql extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -157,7 +157,7 @@ class dbal_mssql_odbc extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -173,7 +173,7 @@ class dbal_mssql_odbc extends dbal
$this->sql_error($query);
}
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -188,7 +188,7 @@ class dbal_mssql_odbc extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -311,7 +311,7 @@ class dbal_mssqlnative extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -329,7 +329,7 @@ class dbal_mssqlnative extends dbal
// reset options for next query
$this->query_options = array();
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -344,7 +344,7 @@ class dbal_mssqlnative extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -167,7 +167,7 @@ class dbal_mysql extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -182,7 +182,7 @@ class dbal_mysql extends dbal
$this->sql_error($query);
}
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -197,7 +197,7 @@ class dbal_mysql extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -174,7 +174,7 @@ class dbal_mysqli extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -189,7 +189,7 @@ class dbal_mysqli extends dbal
$this->sql_error($query);
}
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -199,7 +199,7 @@ class dbal_mysqli extends dbal
$this->query_result = $cache->sql_save($query, $this->query_result, $cache_ttl);
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -236,7 +236,7 @@ class dbal_oracle extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -413,7 +413,7 @@ class dbal_oracle extends dbal
}
}
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -428,7 +428,7 @@ class dbal_oracle extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -194,7 +194,7 @@ class dbal_postgres extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -210,7 +210,7 @@ class dbal_postgres extends dbal
$this->sql_error($query);
}
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -225,7 +225,7 @@ class dbal_postgres extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -112,7 +112,7 @@ class dbal_sqlite extends dbal
global $cache;
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('start', $query);
}
@ -127,7 +127,7 @@ class dbal_sqlite extends dbal
$this->sql_error($query);
}
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
$this->sql_report('stop', $query);
}
@ -142,7 +142,7 @@ class dbal_sqlite extends dbal
$this->open_queries[(int) $this->query_result] = $this->query_result;
}
}
else if (defined('DEBUG_EXTRA'))
else if (defined('DEBUG'))
{
$this->sql_report('fromcache', $query);
}

View File

@ -4191,12 +4191,12 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
$log_text .= '<br /><br />BACKTRACE<br />' . $backtrace;
}
if (defined('IN_INSTALL') || defined('DEBUG_EXTRA') || isset($auth) && $auth->acl_get('a_'))
if (defined('IN_INSTALL') || defined('DEBUG') || isset($auth) && $auth->acl_get('a_'))
{
$msg_text = $log_text;
}
if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db))
if ((defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db))
{
// let's avoid loops
$db->sql_return_on_error(true);
@ -5241,14 +5241,14 @@ function page_footer($run_cron = true)
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report'))
if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG') && method_exists($db, 'sql_report'))
{
$db->sql_report('display');
}
$debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime);
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA'))
if ($auth->acl_get('a_') && defined('DEBUG'))
{
if (function_exists('memory_get_peak_usage'))
{

View File

@ -145,14 +145,14 @@ function adm_page_footer($copyright_html = true)
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG_EXTRA') && method_exists($db, 'sql_report'))
if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG') && method_exists($db, 'sql_report'))
{
$db->sql_report('display');
}
$debug_output = sprintf('Time : %.3fs | ' . $db->sql_num_queries() . ' Queries | GZIP : ' . (($config['gzip_compress']) ? 'On' : 'Off') . (($user->load) ? ' | Load : ' . $user->load : ''), $totaltime);
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA'))
if ($auth->acl_get('a_') && defined('DEBUG'))
{
if (function_exists('memory_get_peak_usage'))
{

View File

@ -528,12 +528,10 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test
if ($debug)
{
$config_data .= "@define('DEBUG', true);\n";
$config_data .= "@define('DEBUG_EXTRA', true);\n";
}
else
{
$config_data .= "// @define('DEBUG', true);\n";
$config_data .= "// @define('DEBUG_EXTRA', true);\n";
}
if ($debug_test)

View File

@ -474,7 +474,7 @@ class phpbb_session
else
{
// Added logging temporarly to help debug bugs...
if (defined('DEBUG_EXTRA') && $this->data['user_id'] != ANONYMOUS)
if (defined('DEBUG') && $this->data['user_id'] != ANONYMOUS)
{
if ($referer_valid)
{

View File

@ -250,7 +250,7 @@ class phpbb_template
* If template cache is writable the compiled php code will be stored
* on filesystem and template will not be subsequently recompiled.
* If template cache is not writable template source will be recompiled
* every time it is needed. DEBUG_EXTRA define and load_tplcompile
* every time it is needed. DEBUG define and load_tplcompile
* configuration setting may be used to force templates to be always
* recompiled.
*
@ -268,7 +268,7 @@ class phpbb_template
{
$output_file = $this->_compiled_file_for_handle($handle);
$recompile = defined('DEBUG_EXTRA') ||
$recompile = defined('DEBUG') ||
!file_exists($output_file) ||
@filesize($output_file) === 0;

View File

@ -162,8 +162,8 @@ class phpbb_user extends phpbb_session
// We include common language file here to not load it every time a custom language file is included
$lang = &$this->lang;
// Do not suppress error if in DEBUG_EXTRA mode
$include_result = (defined('DEBUG_EXTRA')) ? (include $this->lang_path . $this->lang_name . "/common.$phpEx") : (@include $this->lang_path . $this->lang_name . "/common.$phpEx");
// Do not suppress error if in DEBUG mode
$include_result = (defined('DEBUG')) ? (include $this->lang_path . $this->lang_name . "/common.$phpEx") : (@include $this->lang_path . $this->lang_name . "/common.$phpEx");
if ($include_result === false)
{
@ -252,7 +252,7 @@ class phpbb_user extends phpbb_session
// Disable board if the install/ directory is still present
// For the brave development army we do not care about this, else we need to comment out this everytime we develop locally
if (!defined('DEBUG_EXTRA') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
if (!defined('DEBUG') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install'))
{
// Adjust the message slightly according to the permissions
if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))
@ -618,8 +618,8 @@ class phpbb_user extends phpbb_session
return;
}
// Do not suppress error if in DEBUG_EXTRA mode
$include_result = (defined('DEBUG_EXTRA')) ? (include $language_filename) : (@include $language_filename);
// Do not suppress error if in DEBUG mode
$include_result = (defined('DEBUG')) ? (include $language_filename) : (@include $language_filename);
if ($include_result === false)
{

View File

@ -620,7 +620,7 @@ function _sql($sql, &$errored, &$error_ary, $echo_dot = true)
{
global $db;
if (defined('DEBUG_EXTRA'))
if (defined('DEBUG'))
{
echo "<br />\n{$sql}\n<br />";
}

View File

@ -1196,7 +1196,7 @@ class install_convert extends module
$template->assign_block_vars('checks', array(
'TITLE' => "skip_rows = $skip_rows",
'RESULT' => $rows . ((defined('DEBUG_EXTRA') && function_exists('memory_get_usage')) ? ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] : ''),
'RESULT' => $rows . ((defined('DEBUG') && function_exists('memory_get_usage')) ? ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] : ''),
));
$mtime = explode(' ', microtime());
@ -1380,7 +1380,7 @@ class install_convert extends module
}
// When we reach this point, either the current table has been processed or we're running out of time.
if (still_on_time() && $counting < $convert->batch_size/* && !defined('DEBUG_EXTRA')*/)
if (still_on_time() && $counting < $convert->batch_size/* && !defined('DEBUG')*/)
{
$skip_rows = 0;
$current_table++;
@ -1469,7 +1469,7 @@ class install_convert extends module
sync('topic', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, true);
$template->assign_block_vars('checks', array(
'TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, ($sync_batch + $batch_size)) . ((defined('DEBUG_EXTRA') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] . ']' : ''),
'TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, ($sync_batch + $batch_size)) . ((defined('DEBUG') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] . ']' : ''),
'RESULT' => $user->lang['DONE'],
));
@ -1757,7 +1757,7 @@ class install_convert extends module
global $convert;
// Can we use IGNORE with this DBMS?
$sql_ignore = (strpos($db->sql_layer, 'mysql') === 0 && !defined('DEBUG_EXTRA')) ? 'IGNORE ' : '';
$sql_ignore = (strpos($db->sql_layer, 'mysql') === 0 && !defined('DEBUG')) ? 'IGNORE ' : '';
$insert_query = 'INSERT ' . $sql_ignore . 'INTO ' . $schema['target'] . ' (';
$aliases = array();