Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
automatic_updates
Merge requests
!900
Issue
#3363938
: Package Manager should ignore default.settings.php and default.services.yml
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3363938
: Package Manager should ignore default.settings.php and default.services.yml
issue/automatic_updates-3363938:3363938-package-manager-should
into
3.0.x
Overview
1
Commits
14
Pipelines
1
Changes
1
1 unresolved thread
Hide all comments
Merged
Adam G-H
requested to merge
issue/automatic_updates-3363938:3363938-package-manager-should
into
3.0.x
1 year ago
Overview
1
Commits
14
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Viewing commit
9e6226d5
Show latest version
1 file
+
25
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
9e6226d5
Fix bitwise logic
· 9e6226d5
Adam G-H
authored
1 year ago
package_manager/src/PathExcluder/SiteConfigurationExcluder.php
+
25
−
9
Options
@@ -86,25 +86,41 @@ class SiteConfigurationExcluder implements EventSubscriberInterface {
* The event being handled.
*
* @throws \Drupal\Core\File\Exception\FileException
* If the permissions of the
live `sites/default` cannot be determined, or
* changed on the staged `sites/default`.
* If the permissions of the
either the live or staged `sites/default`
*
cannot be determined, or
changed on the staged `sites/default`.
*/
public
function
syncDefaultSiteDirectoryPermissions
(
PreApplyEvent
$event
):
void
{
$live_dir
=
$this
->
getDefaultSiteDirectoryPath
(
$this
->
pathLocator
->
getProjectRoot
());
$staged_dir
=
$this
->
getDefaultSiteDirectoryPath
(
$event
->
stage
->
getStageDirectory
());
$original_permissions
=
fileperms
(
$live_dir
);
if
(
$original_permissions
===
FALSE
)
{
throw
new
FileException
(
"Could not determine permissions for '
$live_dir
'."
);
}
// This is borrowed from \Symfony\Component\Filesystem\Filesystem::copy().
$permissions
=
$this
->
getPermissions
(
$staged_dir
)
|
(
$this
->
getPermissions
(
$live_dir
)
&
0111
);
// @see \Symfony\Component\Filesystem\Filesystem::copy() for another use
// of the 0111 bitmask.
if
(
!
$this
->
fileSystem
->
chmod
(
$staged_dir
,
$original_permissions
&
0111
))
{
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.
*
Loading