parent
2f05ed3d49
commit
47d9426a1f
|
@ -41,7 +41,6 @@ class GeneralConfigPage extends Form
|
|||
// TODO: This is splitted as not all elements are required (as of d201cff)
|
||||
$appForm = new ApplicationConfigForm();
|
||||
$appForm->createElements($formData);
|
||||
$this->addElement($appForm->getElement('global_modulePath'));
|
||||
$this->addElement($appForm->getElement('global_filemode'));
|
||||
|
||||
$loggingForm = new LoggingConfigForm();
|
||||
|
|
|
@ -20,6 +20,8 @@ class ModulePage extends Form
|
|||
|
||||
protected $pageData;
|
||||
|
||||
protected $modulePaths;
|
||||
|
||||
/**
|
||||
* Initialize this page
|
||||
*/
|
||||
|
@ -28,6 +30,11 @@ class ModulePage extends Form
|
|||
$this->setName('setup_modules');
|
||||
$this->setViewScript('form/setup-modules.phtml');
|
||||
$this->session = Session::getSession()->getNamespace(get_class($this));
|
||||
|
||||
$this->modulePaths = array();
|
||||
if (($appModulePath = realpath(Icinga::app()->getApplicationDir() . '/../modules')) !== false) {
|
||||
$this->modulePaths[] = $appModulePath;
|
||||
}
|
||||
}
|
||||
|
||||
public function setPageData(array $pageData)
|
||||
|
@ -115,9 +122,7 @@ class ModulePage extends Form
|
|||
}
|
||||
|
||||
$moduleManager = Icinga::app()->getModuleManager();
|
||||
$moduleManager->detectInstalledModules(
|
||||
explode(':', $this->pageData['setup_general_config']['global_modulePath'])
|
||||
);
|
||||
$moduleManager->detectInstalledModules($this->modulePaths);
|
||||
foreach ($moduleManager->listInstalledModules() as $moduleName) {
|
||||
$this->modules[] = $moduleManager->loadModule($moduleName)->getModule($moduleName);
|
||||
}
|
||||
|
|
|
@ -144,12 +144,6 @@ class WebSetup extends Wizard implements SetupWizard
|
|||
} elseif ($page->getName() === 'setup_modules') {
|
||||
$page->setPageData($this->getPageData());
|
||||
$page->handleRequest($request);
|
||||
} elseif ($page->getName() === 'setup_general_config' && $this->getDirection() === static::FORWARD) {
|
||||
$configData = $this->getPageData($page->getName());
|
||||
if ($configData !== null && $request->getPost('global_modulePath') !== $configData['global_modulePath']) {
|
||||
// Drop the ModulePage's session and all associated wizard sessions once the module path changes
|
||||
$this->getPage('setup_modules')->clearSession();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,10 +133,10 @@ class AuthenticationStep extends Step
|
|||
. '</table>';
|
||||
|
||||
$adminHtml = '<p>' . (isset($this->data['adminAccountData']['resourceConfig']) ? sprintf(
|
||||
t('Administrative rights will initially be granted to an existing account called "%s".'),
|
||||
t('Administrative rights will initially be granted to a new account called "%s".'),
|
||||
$this->data['adminAccountData']['username']
|
||||
) : sprintf(
|
||||
t('Administrative rights will initially be granted to a new account called "%s".'),
|
||||
t('Administrative rights will initially be granted to an existing account called "%s".'),
|
||||
$this->data['adminAccountData']['username']
|
||||
)) . '</p>';
|
||||
|
||||
|
|
|
@ -59,10 +59,6 @@ class GeneralConfigStep extends Step
|
|||
|
||||
$generalHtml = ''
|
||||
. '<ul>'
|
||||
. '<li>' . sprintf(
|
||||
t('Icinga Web 2 will look for modules at: %s'),
|
||||
$this->data['generalConfig']['global_modulePath']
|
||||
) . '</li>'
|
||||
. '<li>' . sprintf(
|
||||
t('Icinga Web 2 will save new configuration files using the mode "%s".'),
|
||||
$this->data['generalConfig']['global_filemode']
|
||||
|
|
|
@ -9,23 +9,27 @@ use Icinga\Application\Icinga;
|
|||
|
||||
class EnableModuleStep extends Step
|
||||
{
|
||||
protected $availableDirs;
|
||||
protected $modulePaths;
|
||||
|
||||
protected $moduleName;
|
||||
|
||||
protected $error;
|
||||
|
||||
public function __construct($availableDirs, $moduleName)
|
||||
public function __construct($moduleName)
|
||||
{
|
||||
$this->availableDirs = $availableDirs;
|
||||
$this->moduleName = $moduleName;
|
||||
|
||||
$this->modulePaths = array();
|
||||
if (($appModulePath = realpath(Icinga::app()->getApplicationDir() . '/../modules')) !== false) {
|
||||
$this->modulePaths[] = $appModulePath;
|
||||
}
|
||||
}
|
||||
|
||||
public function apply()
|
||||
{
|
||||
try {
|
||||
$moduleManager = Icinga::app()->getModuleManager();
|
||||
$moduleManager->detectInstalledModules($this->availableDirs);
|
||||
$moduleManager->detectInstalledModules($this->modulePaths);
|
||||
$moduleManager->enableModule($this->moduleName);
|
||||
} catch (Exception $e) {
|
||||
$this->error = $e;
|
||||
|
|
Loading…
Reference in New Issue