Skip to content

Commit

Permalink
Use a hardcoded path where to look for modules
Browse files Browse the repository at this point in the history
refs #7163
  • Loading branch information
Johannes Meyer committed Oct 29, 2014
1 parent 2f05ed3 commit 47d9426
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
1 change: 0 additions & 1 deletion application/forms/Setup/GeneralConfigPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function createElements(array $formData)
// 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();
Expand Down
11 changes: 8 additions & 3 deletions application/forms/Setup/ModulePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class ModulePage extends Form

protected $pageData;

protected $modulePaths;

/**
* Initialize this page
*/
Expand All @@ -28,6 +30,11 @@ public function init()
$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)
Expand Down Expand Up @@ -115,9 +122,7 @@ public function getModules()
}

$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);
}
Expand Down
6 changes: 0 additions & 6 deletions library/Icinga/Application/WebSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,6 @@ public function setupPage(Form $page, Request $request)
} 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();
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions library/Icinga/Installation/AuthenticationStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ public function getSummary()
. '</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>';

Expand Down
4 changes: 0 additions & 4 deletions library/Icinga/Installation/GeneralConfigStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ public function getSummary()

$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']
Expand Down
12 changes: 8 additions & 4 deletions library/Icinga/Web/Setup/EnableModuleStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,27 @@

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;
Expand Down

0 comments on commit 47d9426

Please sign in to comment.