Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed system panels

  • Loading branch information...
commit 8d1a0236deccdb66425b967d39cf4b5011bfacfe 1 parent 559d580
Matt Curry authored
Showing with 24 additions and 7 deletions.
  1. +13 −5 controllers/status_controller.php
  2. +11 −2 views/elements/system.ctp
View
18 controllers/status_controller.php
@@ -49,10 +49,14 @@ function index() {
function system() {
$free = disk_free_space("/");
$total = disk_total_space("/");
- $perc = round(($free / $total * 100), 2);
- $disk = array('free' => $this->__diskHumanize($free),
- 'total' => $this->__diskHumanize($total),
- 'perc' => $perc);
+ if($free !== false && $total !== false) {
+ $perc = round(($free / $total * 100), 2);
+ $disk = array('free' => $this->__diskHumanize($free),
+ 'total' => $this->__diskHumanize($total),
+ 'perc' => $perc);
+ } else {
+ $disk = false;
+ }
$uptime = exec('uptime');
@@ -86,7 +90,11 @@ function google_analytics($type, $span=1) {
$data = $this->GoogleAnalytics->load($type, array('span' => $span));
$this->set(compact('type', 'data', 'span'));
}
-
+
+/**
+ * I stole the regex part for parsing CakePHP log files from Mark Story's awesome DebugKit
+ * http://thechaw.com/debug_kit/
+ */
function _parseFile($filename) {
$file =& new File($filename);
$contents = $file->read();
View
13 views/elements/system.ctp
@@ -4,12 +4,21 @@
<h1><?php __('System Info') ?></h1>
<?php if(!empty($data['uptime'])) { ?>
- <h2>Uptime</h2>
+ <div>
+ <h2>Uptime</h2>
+ <p><?php echo $data['uptime'] ?></p>
+ </div>
<?php } ?>
<div>
<h2>Disk Space</h2>
<p>
- <?php echo String::insert(':free free of :total (:perc%)', $data['disk']); ?>
+ <?php
+ if($data['disk'] === false) {
+ __('Unable to read disk free space. Probably an open_basedir restriction');
+ } else {
+ echo String::insert(':free free of :total (:perc%)', $data['disk']);
+ }
+ ?>
</p>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.