Merge pull request #403 from kijin/pr/always-save-debug-info

ModuleHandler에서 return하는 경우 디버그 정보가 남지 않는 문제 수정
This commit is contained in:
Kijin Sung 2016-03-24 09:46:59 +09:00
commit c17e4c161c
2 changed files with 27 additions and 2 deletions

View file

@ -448,6 +448,12 @@ class Context
*/ */
public static function close() public static function close()
{ {
// Save debugging information.
if (!DisplayHandler::$debug_printed)
{
DisplayHandler::getDebugInfo();
}
// Check session status and close it if open. // Check session status and close it if open.
if (self::checkSessionStatus()) if (self::checkSessionStatus())
{ {

View file

@ -12,6 +12,7 @@
class DisplayHandler extends Handler class DisplayHandler extends Handler
{ {
public static $response_size = 0; public static $response_size = 0;
public static $debug_printed = 0;
var $content_size = 0; // /< The size of displaying contents var $content_size = 0; // /< The size of displaying contents
var $gz_enabled = FALSE; // / <a flog variable whether to call contents after compressing by gzip var $gz_enabled = FALSE; // / <a flog variable whether to call contents after compressing by gzip
var $handler = NULL; var $handler = NULL;
@ -136,16 +137,34 @@ class DisplayHandler extends Handler
* *
* @return string * @return string
*/ */
public function getDebugInfo(&$output) public function getDebugInfo(&$output = null)
{ {
// Check if debugging information has already been printed.
if (self::$debug_printed)
{
return;
}
else
{
self::$debug_printed = 1;
}
// Check if debugging is enabled for this request. // Check if debugging is enabled for this request.
if (!config('debug.enabled') || !Rhymix\Framework\Debug::isEnabledForCurrentUser()) if (!config('debug.enabled') || !Rhymix\Framework\Debug::isEnabledForCurrentUser())
{ {
return; return;
} }
// Do not display debugging information if there is no output.
$display_type = config('debug.display_type');
if ($output === null && $display_type !== 'file')
{
return;
}
// Print debug information. // Print debug information.
switch ($display_type = config('debug.display_type')) switch ($display_type)
{ {
case 'panel': case 'panel':
$data = Rhymix\Framework\Debug::getDebugData(); $data = Rhymix\Framework\Debug::getDebugData();