mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 15:24:05 +02:00
Create the enabledModules directory when necessary only as well
refs #8219
This commit is contained in:
parent
a95fd561cd
commit
f5a651664c
@ -103,10 +103,7 @@ class Manager
|
|||||||
*/
|
*/
|
||||||
private function detectEnabledModules()
|
private function detectEnabledModules()
|
||||||
{
|
{
|
||||||
$canonical = $this->enableDir;
|
if (! file_exists($this->enableDir)) {
|
||||||
if ($canonical === false || ! file_exists($canonical)) {
|
|
||||||
// TODO: I guess the check for false has something to do with a
|
|
||||||
// call to realpath no longer present
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (! is_dir($this->enableDir)) {
|
if (! is_dir($this->enableDir)) {
|
||||||
@ -121,7 +118,7 @@ class Manager
|
|||||||
$this->enableDir
|
$this->enableDir
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (($dh = opendir($canonical)) !== false) {
|
if (($dh = opendir($this->enableDir)) !== false) {
|
||||||
$this->enabledDirs = array();
|
$this->enabledDirs = array();
|
||||||
while (($file = readdir($dh)) !== false) {
|
while (($file = readdir($dh)) !== false) {
|
||||||
|
|
||||||
@ -129,7 +126,7 @@ class Manager
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = $this->enableDir . '/' . $file;
|
$link = $this->enableDir . DIRECTORY_SEPARATOR . $file;
|
||||||
if (! is_link($link)) {
|
if (! is_link($link)) {
|
||||||
Logger::warning(
|
Logger::warning(
|
||||||
'Found invalid module in enabledModule directory "%s": "%s" is not a symlink',
|
'Found invalid module in enabledModule directory "%s": "%s" is not a symlink',
|
||||||
@ -217,10 +214,15 @@ class Manager
|
|||||||
|
|
||||||
clearstatcache(true);
|
clearstatcache(true);
|
||||||
$target = $this->installedBaseDirs[$name];
|
$target = $this->installedBaseDirs[$name];
|
||||||
$link = $this->enableDir . '/' . $name;
|
$link = $this->enableDir . DIRECTORY_SEPARATOR . $name;
|
||||||
|
|
||||||
if (! is_dir($this->enableDir)) {
|
if (! is_dir($this->enableDir) && !@mkdir($this->enableDir, 02770, true)) {
|
||||||
throw new NotFoundError('Cannot enable module "%s". Path "%s" not found.', $name, $this->enableDir);
|
$error = error_get_last();
|
||||||
|
throw new SystemPermissionException(
|
||||||
|
'Failed to create enabledModule directory "%s" (%s)',
|
||||||
|
$this->enableDir,
|
||||||
|
$error['message']
|
||||||
|
);
|
||||||
} elseif (! is_writable($this->enableDir)) {
|
} elseif (! is_writable($this->enableDir)) {
|
||||||
throw new SystemPermissionException(
|
throw new SystemPermissionException(
|
||||||
'Cannot enable module "%s". Insufficient system permissions for enabling modules.',
|
'Cannot enable module "%s". Insufficient system permissions for enabling modules.',
|
||||||
@ -246,9 +248,7 @@ class Manager
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->enabledDirs[$name] = $link;
|
$this->enabledDirs[$name] = $link;
|
||||||
|
|
||||||
$this->loadModule($name);
|
$this->loadModule($name);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ class Manager
|
|||||||
'Could not disable module. Module path is not writable.'
|
'Could not disable module. Module path is not writable.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$link = $this->enableDir . '/' . $name;
|
$link = $this->enableDir . DIRECTORY_SEPARATOR . $name;
|
||||||
if (! file_exists($link)) {
|
if (! file_exists($link)) {
|
||||||
throw new ConfigurationError(
|
throw new ConfigurationError(
|
||||||
'Could not disable module. The module %s was not found.',
|
'Could not disable module. The module %s was not found.',
|
||||||
|
@ -334,8 +334,6 @@ class WebWizard extends Wizard implements SetupWizard
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$setup->addStep(new MakeDirStep(array(Config::resolvePath('enabledModules')), 2770));
|
|
||||||
|
|
||||||
foreach ($this->getWizards() as $wizard) {
|
foreach ($this->getWizards() as $wizard) {
|
||||||
if ($wizard->isComplete()) {
|
if ($wizard->isComplete()) {
|
||||||
$setup->addSteps($wizard->getSetup()->getSteps());
|
$setup->addSteps($wizard->getSetup()->getSteps());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user