public static function recursiveChown($path, $user, $group = null)
{
// we don't do anything under Windows
if (FileSystem::getOsIdentifier() === self::OS_IDENTIFIER_WIN) {
return;
}
// we don't have a directory to change the user/group permissions for
if (is_dir($path) === false) {
return;
}
// get all the files recursively
$files = FileSystem::globDir($path . '/*');
// query whether we've a user passed
if (empty($user) === false) {
// Change the rights of everything within the defined dirs
foreach ($files as $file) {
FileSystem::chown($file, $user, $group);
}
FileSystem::chown($path, $user, $group);
}
}