respect the umask argument in dumpFile()
This commit is contained in:
parent
c91db73fbb
commit
3a7cd08fe7
@ -516,8 +516,8 @@ class Filesystem
|
||||
}
|
||||
|
||||
$this->chmod($tmpFile, $mode);
|
||||
} else {
|
||||
@chmod($tmpFile, file_exists($filename) ? fileperms($filename) : 0666 & ~umask());
|
||||
} elseif (file_exists($filename)) {
|
||||
@chmod($tmpFile, fileperms($filename));
|
||||
}
|
||||
|
||||
$this->rename($tmpFile, $filename, true);
|
||||
|
@ -1050,6 +1050,19 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->assertSame('bar', file_get_contents($filename));
|
||||
}
|
||||
|
||||
public function testDumpKeepsExistingPermissionsWhenOverwritingAnExistingFile()
|
||||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo.txt';
|
||||
file_put_contents($filename, 'FOO BAR');
|
||||
chmod($filename, 0745);
|
||||
|
||||
$this->filesystem->dumpFile($filename, 'bar', null);
|
||||
|
||||
$this->assertFilePermissions(745, $filename);
|
||||
}
|
||||
|
||||
public function testCopyShouldKeepExecutionPermission()
|
||||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
Reference in New Issue
Block a user