Skip to content

Commit

Permalink
Add the possibility for modules to provide a setup wizard
Browse files Browse the repository at this point in the history
refs #7163
  • Loading branch information
Johannes Meyer committed Oct 24, 2014
1 parent 64e6886 commit a8dd9c9
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions library/Icinga/Application/Modules/Module.php
Expand Up @@ -18,6 +18,7 @@
use Icinga\Web\Menu;
use Icinga\Web\Widget;
use Icinga\Web\Widget\Dashboard\Pane;
use Icinga\Web\Setup\SetupWizard;
use Icinga\Util\File;
use Icinga\Exception\ProgrammingError;
use Icinga\Exception\IcingaException;
Expand Down Expand Up @@ -134,6 +135,13 @@ class Module
*/
private $configTabs = array();

/**
* Provided setup wizard
*
* @var string
*/
private $setupWizard;

/**
* Icinga application
*
Expand Down Expand Up @@ -642,6 +650,31 @@ public function getConfigTabs()
return $tabs;
}

/**
* Whether this module provides a setup wizard
*
* @return bool
*/
public function providesSetupWizard()
{
$this->launchConfigScript();
if (class_exists($this->setupWizard)) {
$wizard = new $this->setupWizard;
return $wizard instanceof SetupWizard;
}

return false;
}

/**
* Return this module's setup wizard
*
* @return SetupWizard
*/
public function getSetupWizard()
{
return new $this->setupWizard;
}

/**
* Provide a named permission
Expand Down Expand Up @@ -705,6 +738,19 @@ protected function provideConfigTab($name, $config = array())
return $this;
}

/**
* Provide a setup wizard
*
* @param string $className The name of the class
*
* @return self
*/
protected function provideSetupWizard($className)
{
$this->setupWizard = $className;
return $this;
}

/**
* Register new namespaces on the autoloader
*
Expand Down

0 comments on commit a8dd9c9

Please sign in to comment.