cvs: pearweb /include pear-prepend.php /public_html admin.php
| From: | Martin Jansen | Date: | Fri, 28 Dec 2001 17:46:13 +0000 |
| Subject: | cvs: pearweb /include pear-prepend.php /public_html admin.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1726@lists.php.net to get a copy of this message | ||
mj Fri Dec 28 12:46:13 2001 EDT
Modified files:
/pearweb/include pear-prepend.php
/pearweb/public_html admin.php
Log:
* Add some system information to admin.php.
Index: pearweb/include/pear-prepend.php
diff -u pearweb/include/pear-prepend.php:1.19 pearweb/include/pear-prepend.php:1.20
--- pearweb/include/pear-prepend.php:1.19 Sun Dec 2 12:28:53 2001
+++ pearweb/include/pear-prepend.php Fri Dec 28 12:46:13 2001
@@ -26,6 +26,29 @@
include_once "pear-format-$format.php";
+/**
+ * Interface to uptime
+ *
+ * Tell how long the system has been running.
+ *
+ * @return string
+ */
+function uptime()
+{
+ $result = exec("uptime");
+
+ $elements = split(" ", $result);
+
+ foreach ($elements as $key => $value) {
+ if ($value == "up") {
+ $uptime = $elements[$key+1] . " " . str_replace(",", "",
$elements[$key+2]);
+ break;
+ }
+ }
+
+ return $uptime;
+}
+
if (DEVBOX && empty($dbh)) {
$dbh = DB::connect(PEAR_DATABASE_DSN, array('persistent' => true));
}
Index: pearweb/public_html/admin.php
diff -u pearweb/public_html/admin.php:1.4 pearweb/public_html/admin.php:1.5
--- pearweb/public_html/admin.php:1.4 Thu Dec 27 22:51:33 2001
+++ pearweb/public_html/admin.php Fri Dec 28 12:46:13 2001
@@ -215,6 +215,15 @@
} while (false);
+echo "<br/><br/>";
+
+$bb = new BorderBox("System information", "50%");
+
+echo "Uptime: " . uptime() . "<br/>";
+echo "Disk space: " . round((disk_total_space("/")/(1000*1000*1000)),2) .
" GB (available: " . round((diskfreespace("/")/(1000*1000*1000)),2) . "
GB)<br/>";
+
+$bb->end();
+
response_footer();
?>