Skip to content
Snippets Groups Projects
Commit 44e610d3 authored by Adam G-H's avatar Adam G-H
Browse files

OK, we do not need to do weird grab-ass stuff

parent ce2af104
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !900. Comments created here will be created in the context of that merge request.
......@@ -112,37 +112,16 @@ class SiteConfigurationExcluder implements EventSubscriberInterface {
}
$live_dir = $this->getDefaultSiteDirectoryPath($this->pathLocator->getProjectRoot());
// This is borrowed from \Symfony\Component\Filesystem\Filesystem::copy(),
// to ensure the correct permissions are preserved (chmod() requires
// permissions to be sent as an octal number, but fileperms() returns a
// decimal number, because PHP is just great).
$permissions = $this->getPermissions($staged_dir) | ($this->getPermissions($live_dir) & 0111);
$permissions = fileperms($live_dir);
if ($permissions === FALSE) {
throw new FileException("Could not determine permissions for '$live_dir'.");
}
if (!$this->fileSystem->chmod($staged_dir, $permissions)) {
throw new FileException("Could not change permissions on '$staged_dir'.");
}
}
/**
* Gets the current file permissions of a path.
*
* @param string $path
* The path to examine.
*
* @return int
* The current permissions of the path.
*
* @throws \Drupal\Core\File\Exception\FileException
* Thrown if the file permissions cannot be determined.
*/
private function getPermissions(string $path): int {
$permissions = fileperms($path);
if ($permissions === FALSE) {
throw new FileException("Could not determine permissions for '$path'.");
}
return $permissions;
}
/**
* Returns the full path to `sites/default`, relative to a root directory.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment