Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssetAdapter - If the visibility is already correct, do not try to re-set it. #563

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/Flysystem/AssetAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,26 @@ protected function configureServer($forceOverwrite = false)

// Apply each configuration
$config = new FlysystemConfig();
$config->set('visibility', $visibility);
foreach ($configurations as $file => $template) {
// Ensure file contents
if ($forceOverwrite || !$this->has($file)) {
if ($this->has($file)) {
$perms = $this->getVisibility($file);
// If the visibility is already correct, do not try to re-set it.
// Attempting to set the visibility of a file/folder when the filesystem is already
// set correctly causes "Operation not permitted" errors on some Linux servers.
if ($perms['visibility'] !== $visibility) {
$config->set('visibility', $visibility);
}
}
// Evaluate file
$content = $this->renderTemplate($template);
$success = $this->write($file, $content, $config);
if (!$success) {
throw new Exception("Error writing server configuration file \"{$file}\"");
}
}

$perms = $this->getVisibility($file);
if ($perms['visibility'] !== $visibility) {
// Ensure correct permissions
Expand Down