Replaces exec('uptime') with sys_getloadavg()
authorAlexander Ebert <ebert@woltlab.com>
Thu, 18 Jul 2013 13:42:09 +0000 (15:42 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 18 Jul 2013 13:42:09 +0000 (15:42 +0200)
wcfsetup/install/files/lib/acp/page/IndexPage.class.php

index 3a1fae946fe9bf8db27cba7a2b4ab8328c9ce42e..0c279ad7e65e90728d5ccb506f9f1ee7ae1153a4 100755 (executable)
@@ -41,10 +41,9 @@ class IndexPage extends AbstractPage {
                );
                
                // get load
-               if ($uptime = @exec("uptime")) {
-                       if (preg_match("/averages?: ([0-9\.]+,?[\s]+[0-9\.]+,?[\s]+[0-9\.]+)/", $uptime, $match)) {
-                               $this->server['load'] = $match[1];
-                       }
+               if (function_exists('sys_getloadavg')) {
+                       $load = sys_getloadavg();
+                       $this->server['load'] = implode(', ', $load);
                }
        }