1 <?php
defined('SYSPATH') OR die('No direct access allowed.');
3 $table_crashed = function($error_string) {
4 if(preg_match("~Table '([^']+)' is marked as crashed and should be repaired~", $error_string, $match)) {
10 $content = '<div id="framework_error" style="width:42em;margin:0px auto;">';
11 $content .= '<h3>'.html
::specialchars($error).'</h3>';
12 $content .= '<p>'.html
::specialchars($description).'</p>';
14 if($table = $table_crashed($message)) {
15 $content .= $crash_info = "<p>The table $table is marked as crashed: login as root on the Monitor server and run</p><pre>mysqlcheck --repair --databases merlin</pre><p>There is more information in the <a href='https://dev.mysql.com/doc/refman/5.0/en/rebuilding-tables.html'>MySQL manual</a>.</p>";
18 if ( ! empty($line) AND ! empty($file)) {
19 $content .= '<p>'.Kohana
::lang('core.error_file_line', $file, $line).'</p>';
21 $content .= '<p><code class="block">'.$message.'<code></p>';
22 if ( ! empty($trace)){
23 $content .= '<h3>'.Kohana
::lang('core.stack_trace').'</h3>';
26 $content .= '<p class="stats">'.Kohana
::lang('core.stats_footer').'</p>';
27 foreach(Kohana
::config('exception.shell_commands') as $command) {
28 exec($command, $output, $exit_value);
29 $content .= "<p class='stats'>$command (exit code $exit_value):<br />".implode('<br />', $output).'</p>';
31 foreach(Kohana
::config('exception.extra_info') as $header => $info) {
32 $content .= "<p class='stats'>$header: $info</p>";
36 $content .= '<style type="text/css">'.file_get_contents(Kohana
::find_file('views', 'kohana_errors', FALSE, 'css')).'</style>';
41 $tmp_dir = Kohana
::Config('exception.tmp_dir') ? Kohana
::Config('exception.tmp_dir') : '/tmp/ninja-stacktraces/';
42 $tmp_dir_perm = Kohana
::Config('exception.tmp_dir_perm') ? Kohana
::Config('exception.tmp_dir_perm') : 0700;
43 @mkdir
($tmp_dir, $tmp_dir_perm, true);
44 $file = tempnam($tmp_dir, date('Ymd-hi').'-');
45 $fd = fopen($file, 'w');
46 $error_data = "<html><body>$content</body></html>";
48 fwrite($fd, $error_data) or $writeerror = true;
52 $content = '<div><h3>There was an error rendering the page</h3>';
54 $content .= '<p>Please contact your administrator.<br />The debug information in '.$file.' will be essential to troubleshooting the problem, so please include it if you file a bug report or contact op5 Support.</p></div>';
56 // by special casing this here once, we save some support time every time
57 // log data clobbers a customers hard drive
58 $content .= "<p>Additionally, there was an error when trying to save the debug information to a file in '$tmp_dir'. Please make sure that your hard drive isn't full.</p></div>";
60 $content .= $crash_info;
64 require('menu/menu.php');
67 if ($_SERVER['REQUEST_METHOD'] == 'POST')
68 $disable_refresh = true;
70 $current_skin = 'default/';
71 require('template.php');