mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-25 14:54:24 +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()
|
||||
{
|
||||
$canonical = $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
|
||||
if (! file_exists($this->enableDir)) {
|
||||
return;
|
||||
}
|
||||
if (! is_dir($this->enableDir)) {
|
||||
@ -121,7 +118,7 @@ class Manager
|
||||
$this->enableDir
|
||||
);
|
||||
}
|
||||
if (($dh = opendir($canonical)) !== false) {
|
||||
if (($dh = opendir($this->enableDir)) !== false) {
|
||||
$this->enabledDirs = array();
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
|
||||
@ -129,7 +126,7 @@ class Manager
|
||||
continue;
|
||||
}
|
||||
|
||||
$link = $this->enableDir . '/' . $file;
|
||||
$link = $this->enableDir . DIRECTORY_SEPARATOR . $file;
|
||||
if (! is_link($link)) {
|
||||
Logger::warning(
|
||||
'Found invalid module in enabledModule directory "%s": "%s" is not a symlink',
|
||||
@ -217,10 +214,15 @@ class Manager
|
||||
|
||||
clearstatcache(true);
|
||||
$target = $this->installedBaseDirs[$name];
|
||||
$link = $this->enableDir . '/' . $name;
|
||||
$link = $this->enableDir . DIRECTORY_SEPARATOR . $name;
|
||||
|
||||
if (! is_dir($this->enableDir)) {
|
||||
throw new NotFoundError('Cannot enable module "%s". Path "%s" not found.', $name, $this->enableDir);
|
||||
if (! is_dir($this->enableDir) && !@mkdir($this->enableDir, 02770, true)) {
|
||||
$error = error_get_last();
|
||||
throw new SystemPermissionException(
|
||||
'Failed to create enabledModule directory "%s" (%s)',
|
||||
$this->enableDir,
|
||||
$error['message']
|
||||
);
|
||||
} elseif (! is_writable($this->enableDir)) {
|
||||
throw new SystemPermissionException(
|
||||
'Cannot enable module "%s". Insufficient system permissions for enabling modules.',
|
||||
@ -246,9 +248,7 @@ class Manager
|
||||
}
|
||||
|
||||
$this->enabledDirs[$name] = $link;
|
||||
|
||||
$this->loadModule($name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ class Manager
|
||||
'Could not disable module. Module path is not writable.'
|
||||
);
|
||||
}
|
||||
$link = $this->enableDir . '/' . $name;
|
||||
$link = $this->enableDir . DIRECTORY_SEPARATOR . $name;
|
||||
if (! file_exists($link)) {
|
||||
throw new ConfigurationError(
|
||||
'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) {
|
||||
if ($wizard->isComplete()) {
|
||||
$setup->addSteps($wizard->getSetup()->getSteps());
|
||||
|
Loading…
x
Reference in New Issue
Block a user