Ensures that a given directory is world readable.
Drupal\Core\FileTransfer\FileTransferInterface $filetransfer: Object which is a child of FileTransfer.
string $path: The file path to make world readable.
bool $recursive: If the chmod should be applied recursively.
public function makeWorldReadable(&$filetransfer, $path, $recursive = TRUE) {
if (!is_executable($path)) {
// Set it to read + execute.
$new_perms = substr(sprintf('%o', fileperms($path)), -4, -1) . "5";
$filetransfer
->chmod($path, intval($new_perms, 8), $recursive);
}
}