Manager: Ensure enableModule dir has correct permission when created

This commit is contained in:
Sukhwinder Dhillon 2022-06-02 14:08:16 +02:00 committed by Johannes Meyer
parent 77060ed312
commit c0d247613d

View File

@ -280,13 +280,17 @@ class Manager
$target = $this->installedBaseDirs[$name]; $target = $this->installedBaseDirs[$name];
$link = $this->enableDir . DIRECTORY_SEPARATOR . $name; $link = $this->enableDir . DIRECTORY_SEPARATOR . $name;
if (! is_dir($this->enableDir) && !@mkdir($this->enableDir, 02770, true)) { if (! is_dir($this->enableDir)) {
$error = error_get_last(); if (!@mkdir($this->enableDir, 0777, true)) {
throw new SystemPermissionException( $error = error_get_last();
'Failed to create enabledModules directory "%s" (%s)', throw new SystemPermissionException(
$this->enableDir, 'Failed to create enabledModules directory "%s" (%s)',
$error['message'] $this->enableDir,
); $error['message']
);
}
chmod($this->enableDir, 02770);
} elseif (! is_writable($this->enableDir)) { } elseif (! is_writable($this->enableDir)) {
throw new SystemPermissionException( throw new SystemPermissionException(
'Cannot enable module "%s". Check the permissions for the enabledModules directory: %s', 'Cannot enable module "%s". Check the permissions for the enabledModules directory: %s',