controllers, library: small fixes

This commit is contained in:
Thomas Gelf 2018-06-23 09:05:10 +02:00
parent 35815e0dad
commit 88f7dc0d0f
4 changed files with 14 additions and 4 deletions

View File

@ -17,7 +17,10 @@ use dipl\Html\Link;
class ImportsourceController extends ActionController
{
/**
* @throws \Icinga\Exception\AuthenticationException
* @throws \Icinga\Exception\Http\HttpNotFoundException
* @throws \Icinga\Exception\NotFoundError
* @throws \Icinga\Security\SecurityException
*/
public function init()
{
@ -33,6 +36,7 @@ class ImportsourceController extends ActionController
/**
* @throws \Icinga\Exception\ConfigurationError
* @throws \Icinga\Exception\IcingaException
* @throws \Icinga\Exception\MissingParameterException
* @throws \Icinga\Exception\NotFoundError
*/
@ -40,7 +44,7 @@ class ImportsourceController extends ActionController
{
$source = ImportSource::load($this->params->getRequired('id'), $this->db());
if ($this->params->get('format') === 'json') {
$this->sendJson($this->getResponse());
$this->sendJson($this->getResponse(), $source->export());
return;
}
$this->addTitle(
@ -54,7 +58,6 @@ class ImportsourceController extends ActionController
null,
[
'data-base-target' => '_blank',
]
)
);

View File

@ -11,6 +11,10 @@ class IndexController extends DashboardController
{
protected $hasDeploymentEndpoint;
/**
* @throws \Icinga\Exception\ConfigurationError
* @throws \Icinga\Exception\Http\HttpNotFoundException
*/
public function indexAction()
{
if ($this->Config()->get('db', 'resource')) {

View File

@ -5,8 +5,8 @@ namespace Icinga\Module\Director\Db;
use DirectoryIterator;
use Exception;
use Icinga\Application\Icinga;
use Icinga\Exception\IcingaException;
use Icinga\Module\Director\Data\Db\DbConnection;
use RuntimeException;
class Migrations
{
@ -25,7 +25,7 @@ class Migrations
public function __construct(DbConnection $connection)
{
if (version_compare(PHP_VERSION, '5.4.0') < 0) {
throw new IcingaException(
throw new RuntimeException(
"PHP version 5.4.x is required for Director >= 1.4.0, you're running %s."
. ' Please either upgrade PHP or downgrade Icinga Director',
PHP_VERSION

View File

@ -31,6 +31,7 @@ class IcingaTemplateRepository
* @param IcingaObject $object
* @param bool $recursive
* @return IcingaObject[]
* @throws \Icinga\Exception\NotFoundError
*/
public function getTemplatesFor(IcingaObject $object, $recursive = false)
{
@ -47,6 +48,7 @@ class IcingaTemplateRepository
* @param array $ids
* @param IcingaObject $object
* @return IcingaObject[]
* @throws \Icinga\Exception\NotFoundError
*/
public function getTemplatesForIds(array $ids, IcingaObject $object)
{
@ -70,6 +72,7 @@ class IcingaTemplateRepository
* @param IcingaObject $object
* @param bool $recursive
* @return IcingaObject[]
* @throws \Icinga\Exception\NotFoundError
*/
public function getTemplatesIndexedByNameFor(
IcingaObject $object,