Display the server load average in the platform block. Fixes ticket #198.

This commit is contained in:
Bharat Mediratta 2009-05-13 01:32:11 +00:00
parent 238cb7ff6e
commit 983dc66684
2 changed files with 9 additions and 0 deletions

View File

@ -64,6 +64,12 @@ class core_block_Core {
$block->css_id = "gPlatform";
$block->title = t("Platform Information");
$block->content = new View("admin_block_platform.html");
if (is_readable("/proc/loadavg")) {
$block->content->load_average =
join(" ", array_slice(split(" ", array_shift(file("/proc/loadavg"))), 0, 3));
} else {
$block->content->load_average = t("Unavailable");
}
break;
case "project_news":

View File

@ -12,4 +12,7 @@
<li>
<?= t("MySQL: %mysql_version", array("mysql_version" => Database::instance()->query("SELECT version() as v")->current()->v)) ?>
</li>
<li>
<?= t("Server load: %load_average", array("load_average" => $load_average)) ?>
</li>
</ul>