Changeset 1898 for trunk/system/core/Kohana.php
- Timestamp:
- 02/01/2008 06:22:27 PM (10 months ago)
- Files:
-
- 1 modified
-
trunk/system/core/Kohana.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/core/Kohana.php
r1886 r1898 85 85 set_exception_handler(array('Kohana', 'exception_handler')); 86 86 87 if (Config::item('log.threshold') > 0)88 {89 // Enable log writing if the log threshold is above 090 register_shutdown_function(array('Log', 'write'));91 }92 93 87 // Disable magic_quotes_runtime. The Input library takes care of 94 88 // magic_quotes_gpc later. … … 100 94 // Set locale information 101 95 setlocale(LC_ALL, Config::item('locale.language').'.UTF-8'); 96 97 if (Config::item('log.threshold') > 0) 98 { 99 // Get the configured log directory 100 $log_dir = Config::item('log.directory'); 101 102 // Two possible locations 103 $app_log = APPPATH.$log_dir; 104 $log_dir = realpath($log_dir); 105 106 // If the log directory does not exist, log inside of application/ 107 is_dir($log_dir) or $log_dir = $app_log; 108 109 // Log directory must be writable 110 if ( ! is_dir($log_dir) OR ! is_writable($log_dir)) 111 throw new Kohana_Exception('core.cannot_write_log'); 112 113 // Set the log directory 114 Log::directory($log_dir); 115 116 // Enable log writing if the log threshold is above 0 117 register_shutdown_function(array('Log', 'write')); 118 } 102 119 103 120 // Enable Kohana routing … … 311 328 public static function shutdown() 312 329 { 330 while (ob_get_level() > self::$buffer_level) 331 { 332 // Flush all open output buffers above the internal buffer 333 ob_end_flush(); 334 } 335 313 336 // This will flush the Kohana buffer, which sets self::$output 314 337 (ob_get_level() === self::$buffer_level) and ob_end_clean(); … … 317 340 Event::run('system.display', self::$output); 318 341 319 // Render the output342 // Render the final output 320 343 self::render(self::$output); 321 344 } … … 490 513 } 491 514 492 if (ob_get_level() >= self::$buffer_level) 493 { 494 // Flush the entire buffer here, to ensure the error is displayed 495 while(ob_get_level() > self::$buffer_level) ob_end_clean(); 496 497 // Clear out the output buffer 498 ob_clean(); 515 while (ob_get_level() > self::$buffer_level) 516 { 517 // Clean all active output buffers 518 ob_end_clean(); 499 519 } 500 520 … … 526 546 // Run the system.shutdown event 527 547 Event::has_run('system.shutdown') or Event::run('system.shutdown'); 548 549 // Turn off error reporting 550 error_reporting(0); 528 551 exit; 529 552 }
