mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
legacy: Allow configuration for file modes
This commit is contained in:
parent
93e1a88e10
commit
7817c3b781
@ -19,8 +19,8 @@ class LegacyDeploymentApi implements DeploymentApiInterface
|
|||||||
protected $deploymentPath;
|
protected $deploymentPath;
|
||||||
protected $activationScript;
|
protected $activationScript;
|
||||||
|
|
||||||
const DIR_MODE = 0775;
|
protected $dir_mode;
|
||||||
const FILE_MODE = 0664;
|
protected $file_mode;
|
||||||
|
|
||||||
public function __construct(Db $db)
|
public function __construct(Db $db)
|
||||||
{
|
{
|
||||||
@ -28,6 +28,9 @@ class LegacyDeploymentApi implements DeploymentApiInterface
|
|||||||
$settings = $this->db->settings();
|
$settings = $this->db->settings();
|
||||||
$this->deploymentPath = $settings->deployment_path_v1;
|
$this->deploymentPath = $settings->deployment_path_v1;
|
||||||
$this->activationScript = $settings->activation_script_v1;
|
$this->activationScript = $settings->activation_script_v1;
|
||||||
|
|
||||||
|
$this->dir_mode = base_convert($settings->get('deployment_file_mode_v1', '2775'), 8, 10);
|
||||||
|
$this->file_mode = base_convert($settings->get('deployment_dir_mode_v1', '0664'), 8, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -279,7 +282,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface
|
|||||||
if ($fh === null) {
|
if ($fh === null) {
|
||||||
throw new IcingaException('Could not open file "%s" for writing.', $fullPath);
|
throw new IcingaException('Could not open file "%s" for writing.', $fullPath);
|
||||||
}
|
}
|
||||||
chmod($fullPath, self::FILE_MODE);
|
chmod($fullPath, $this->file_mode);
|
||||||
|
|
||||||
fwrite($fh, $content);
|
fwrite($fh, $content);
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
@ -454,7 +457,7 @@ class LegacyDeploymentApi implements DeploymentApiInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
mkdir($path);
|
mkdir($path);
|
||||||
chmod($path, self::DIR_MODE);
|
chmod($path, $this->dir_mode);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new IcingaException('Could not create path "%s": %s', $path, $e->getMessage());
|
throw new IcingaException('Could not create path "%s": %s', $path, $e->getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user