Added filterable to summary and histogram controllers
[ninja.git] / application / views / kohana_error_page.php
blobc7eed3178883429982c29a51d658e0b101e5fdc4
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)) {
5 return $match[1];
7 return null;
8 };
10 $content = '<div id="framework_error">';
11 $content .= '<h3>'.html::specialchars($error).'</h3>';
12 $content .= '<p>'.html::specialchars($description).'</p>';
13 $crash_info = null;
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>';
24 $content .= $trace;
26 $content .= '<p class="stats">'.Kohana::lang('core.stats_footer').'</p>';
27 foreach(Kohana::config('exception.shell_commands') as $command) {
28 $output = null;
29 exec($command, $output, $exit_value);
30 $content .= "<p class='stats'><b>$command</b> (exit code $exit_value):<br />".implode('<br />', $output).'</p>';
32 foreach(Kohana::config('exception.extra_info') as $header => $info) {
33 $content .= "<p class='stats'>$header: $info</p>";
35 $content .= '</div>';
37 $content .= '<style type="text/css">'.file_get_contents(Kohana::find_file('views', 'kohana_errors', FALSE, 'css')).'</style>';
38 $js = array();
39 $css = array();
41 if (IN_PRODUCTION) {
42 $tmp_dir = Kohana::Config('exception.tmp_dir') ? Kohana::Config('exception.tmp_dir') : '/tmp/ninja-stacktraces/';
43 $tmp_dir_perm = Kohana::Config('exception.tmp_dir_perm') ? Kohana::Config('exception.tmp_dir_perm') : 0700;
44 @mkdir($tmp_dir, $tmp_dir_perm, true);
45 $file = tempnam($tmp_dir, date('Ymd-hi').'-');
46 $fd = fopen($file, 'w');
47 $error_data = "<html><body>$content</body></html>";
48 $writeerror = false;
49 fwrite($fd, $error_data) or $writeerror = true;
51 fclose($fd);
53 $content = '<div><h3>There was an error rendering the page</h3>';
54 if (!$writeerror) {
55 $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 } else {
57 // by special casing this here once, we save some support time every time
58 // log data clobbers a customers hard drive
59 $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>";
61 $content .= $crash_info;
62 unset($tmp_dir);
64 $title = 'Error';
65 require('menu/menu.php');
66 $links = $menu_base;
68 if ($_SERVER['REQUEST_METHOD'] == 'POST')
69 $disable_refresh = true;
71 $current_skin = 'default/';
72 require('template.php');