public function setGroup($group, $recursive = False)
{
if (function_exists('posix_getgrnam') && function_exists('posix_getgrgid')) {
if (posix_getgrnam($group) == False xor is_numeric($group) && posix_getgrgid($group) == False) {
throw new CFileException('Unable to set group for filesystem object. Group "' . $group . '" is not found.');
}
}
if ($this->getExists()) {
$success = @chgrp($this->_realpath, $group);
if ($success) {
$this->_group = $group;
}
if ($success && $this->getIsDir() && $recursive) {
$contents = $this->getContents(True);
foreach ($contents as $filepath) {
if (!@chgrp($filepath, $group)) {
$this->addLog('Unable to set group for "' . $filepath . '" to "' . $group . '"');
$success = False;
}
}
}
if ($success) {
return $this;
}
}
$this->addLog('Unable to set group for filesystem object to "' . $group . '"');
return False;
}