Skip to content

Commit 1e5c9f5

Browse files
committed
Page debug
1 parent faf2499 commit 1e5c9f5

2 files changed

Lines changed: 51 additions & 30 deletions

File tree

src/Template/Element/aside/sidebar-menu.ctp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,6 @@ if (file_exists($file)) {
149149
<li><a href="#"><i class="fa fa-circle-o text-red"></i> <span>Important</span></a></li>
150150
<li><a href="#"><i class="fa fa-circle-o text-yellow"></i> <span>Warning</span></a></li>
151151
<li><a href="#"><i class="fa fa-circle-o text-aqua"></i> <span>Information</span></a></li>
152+
<li><a href="<?php echo $this->Url->build('/pages/debug'); ?>"><i class="fa fa-bug"></i> Debug</a></li>
152153
</ul>
153154
<?php } ?>

src/Template/Pages/debug.ctp

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@ endif;
6262

6363
<div class="row">
6464
<div class="col-md-12">
65-
<div class="callout callout-info">
65+
<?php
66+
$class = 'callout-warning';
67+
68+
if (version_compare(PHP_VERSION, '5.5.9', '>=') && extension_loaded('mbstring') && extension_loaded('openssl') && extension_loaded('mcrypt') && extension_loaded('intl')) {
69+
$class = 'callout-success';
70+
}
71+
?>
72+
<div class="callout <?= $class ?>">
6673
<h4>Environment</h4>
6774
<?php if (version_compare(PHP_VERSION, '5.5.9', '>=')): ?>
6875
<p class="success">Your version of PHP is 5.5.9 or higher (detected <?= phpversion() ?>).</p>
@@ -95,21 +102,28 @@ endif;
95102

96103
<div class="row">
97104
<div class="col-md-12">
98-
<div class="callout callout-info">
105+
<?php
106+
$settings = Cache::config('_cake_core_');
107+
$class = 'callout-warning';
108+
109+
if (is_writable(TMP) && is_writable(LOGS) && !empty($settings)) {
110+
$class = 'callout-success';
111+
}
112+
?>
113+
<div class="callout <?= $class ?>">
99114
<h4>Filesystem</h4>
100115
<?php if (is_writable(TMP)): ?>
101116
<p class="success">Your tmp directory is writable.</p>
102117
<?php else: ?>
103-
<p class="problem">Your tmp directory is NOT writable.</p>
118+
<p class="text-red">Your tmp directory is NOT writable.</p>
104119
<?php endif; ?>
105120

106121
<?php if (is_writable(LOGS)): ?>
107122
<p class="success">Your logs directory is writable.</p>
108123
<?php else: ?>
109-
<p class="problem">Your logs directory is NOT writable.</p>
124+
<p class="text-red">Your logs directory is NOT writable.</p>
110125
<?php endif; ?>
111126

112-
<?php $settings = Cache::config('_cake_core_'); ?>
113127
<?php if (!empty($settings)): ?>
114128
<p class="success">The <em><?= $settings['className'] ?>Engine</em> is being used for core caching. To change the config edit config/app.php</p>
115129
<?php else: ?>
@@ -121,42 +135,48 @@ endif;
121135

122136
<div class="row">
123137
<div class="col-md-12">
124-
<div class="callout callout-info">
125-
<h4>Database</h4>
126-
<?php
127-
try {
128-
$connection = ConnectionManager::get('default');
129-
$connected = $connection->connect();
130-
} catch (Exception $connectionError) {
131-
$connected = false;
132-
$errorMsg = $connectionError->getMessage();
133-
if (method_exists($connectionError, 'getAttributes')):
134-
$attributes = $connectionError->getAttributes();
135-
if (isset($errorMsg['message'])):
136-
$errorMsg .= '<br />' . $attributes['message'];
137-
endif;
138+
<?php
139+
try {
140+
$connection = ConnectionManager::get('default');
141+
$connected = $connection->connect();
142+
} catch (Exception $connectionError) {
143+
$connected = false;
144+
$errorMsg = $connectionError->getMessage();
145+
if (method_exists($connectionError, 'getAttributes')):
146+
$attributes = $connectionError->getAttributes();
147+
if (isset($errorMsg['message'])):
148+
$errorMsg .= '<br />' . $attributes['message'];
138149
endif;
139-
}
140-
?>
150+
endif;
151+
}
152+
?>
141153
<?php if ($connected): ?>
142-
<p class="success">CakePHP is able to connect to the database.</p>
154+
<div class="callout callout-info">
155+
<h4>Database</h4>
156+
<p class="success">CakePHP is able to connect to the database.</p>
157+
</div>
143158
<?php else: ?>
144-
<p class="problem">CakePHP is NOT able to connect to the database.<br /><br /><?= $errorMsg ?></p>
159+
<div class="callout callout-danger">
160+
<h4>Database</h4>
161+
<p class="problem">CakePHP is NOT able to connect to the database.<br /><br /><?= $errorMsg ?></p>
162+
</div>
145163
<?php endif; ?>
146-
</div>
147164
</div>
148165
</div>
149166

150167
<div class="row">
151168
<div class="col-md-12">
152-
<div class="callout callout-info">
153-
<h4>DebugKit</h4>
154-
<?php if (Plugin::loaded('DebugKit')): ?>
155-
<p class="success">DebugKit is loaded.</p>
169+
<?php if (Plugin::loaded('DebugKit')): ?>
170+
<div class="callout callout-success">
171+
<h4>DebugKit</h4>
172+
<p class="success">DebugKit is loaded.</p>
173+
</div>
156174
<?php else: ?>
175+
<div class="callout callout-danger">
176+
<h4>DebugKit</h4>
157177
<p class="problem">DebugKit is NOT loaded. You need to either install pdo_sqlite, or define the "debug_kit" connection name.</p>
178+
</div>
158179
<?php endif; ?>
159-
</div>
160180
</div>;
161181
</div>
162182

@@ -181,7 +201,7 @@ endif;
181201
</div>
182202
</div>
183203
</div>
184-
204+
185205
<div class="row">
186206
<div class="col-md-12">
187207
<div class="callout callout-info">

0 commit comments

Comments
 (0)