New packages: File_Fstab & System_Mount
| From: | Ian Eure | Date: | Thu, 15 Jan 2004 21:28:08 +0000 |
| Subject: | New packages: File_Fstab & System_Mount | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-25081@lists.php.net to get a copy of this message | ||
Got to hacking around with PEAR last night, and put together some packages to
handle parsing /etc/fstab and mounting/unmounting the devices therein.
File_Fstab only handles parsing the fstab file, and System_Mount builds on it.
File_Fstab can also be used to parse mtab, and System_Mount uses it in this
way to determine if a device is mounted or not.
e.g.:
$devices = new System_Mount;
$cdrom = $devices->getEntryForPath('/cdrom');
if (PEAR::isError($cdrom)) {
die($cdrom->getMessage());
}
if ($cdrom->isMounted()) {
$cdrom->unMount();
} else {
$cdrom->mount();
}
It's at the same places as all my other PEAR stuff,
http://www.websprockets.com/~ieure/PEAR/
Hope somebody find it useful.