note 106242 deleted from function.disk-total-space by danbrown
| From: | danbrown@php.net | Date: | Thu, 20 Oct 2011 23:08:10 +0000 |
| Subject: | note 106242 deleted from function.disk-total-space by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184037@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
@ f.get_files()
I had to modify the "unix" portion of the get_files() sample function to get it to work on
my CentOS install. Minor change, but instead of parsing every token of mount's output as a big
string, it is broken into multiple lines, checks the first token for the "dev" check, and
the third token as the disk identifier:
[php]
// unix
$data =
/bin/mount;
$data = explode("\n", $data);
$disks = array();
foreach ($data as $line) {
$tokens = explode(' ', $line);
if (($dname = substr($tokens[0], 0, 5)) == '/dev/') $disks[] = $tokens[2];
}
[/php]