function Filesystem::chmod
Same name in this branch
- 11.1.x core/lib/Drupal/Core/File/FileSystem.php \Drupal\Core\File\FileSystem::chmod()
Change mode for an array of files or directories.
Parameters
int $mode The new mode (octal):
int $umask The mode mask (octal):
bool $recursive Whether change the mod recursively or not:
Throws
IOException When the change fails
File
-
vendor/
symfony/ filesystem/ Filesystem.php, line 211
Class
- Filesystem
- Provides basic utility to manipulate the file system.
Namespace
Symfony\Component\FilesystemCode
public function chmod(string|iterable $files, int $mode, int $umask = 00, bool $recursive = false) : void {
foreach ($this->toIterable($files) as $file) {
if (!self::box('chmod', $file, $mode & ~$umask)) {
throw new IOException(\sprintf('Failed to chmod file "%s": ', $file) . self::$lastError, 0, null, $file);
}
if ($recursive && is_dir($file) && !is_link($file)) {
$this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
}
}
}