summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-06-06 21:08:10 -0700
committerBharat Mediratta <bharat@menalto.com>2010-06-06 21:08:10 -0700
commitab0bef14be78701aedd647dd4eaccab641b6d01d (patch)
treee246c4961164cf84cbeadc423e49bc162afa11dd /modules
parent0c1fb039145c824147fbd587edc9332d82c1ac4b (diff)
Try to adjust for situations where /proc/loadavg is_readable() but
generates an error if we call file() on it. Fixes ticket #1149.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/gallery_block.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php
index 08ce21b7..cb28cbcd 100644
--- a/modules/gallery/helpers/gallery_block.php
+++ b/modules/gallery/helpers/gallery_block.php
@@ -70,9 +70,9 @@ class gallery_block_Core {
$block->css_id = "g-platform";
$block->title = t("Platform information");
$block->content = new View("admin_block_platform.html");
- if (@is_readable("/proc/loadavg")) {
+ if (@is_readable("/proc/loadavg") && $first_line = current(@file("/proc/loadavg"))) {
$block->content->load_average =
- join(" ", array_slice(explode(" ", current(file("/proc/loadavg"))), 0, 3));
+ join(" ", array_slice(explode(" ", $first_line), 0, 3));
} else {
$block->content->load_average = t("Unavailable");
}