mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
application: PSR2 fixes
This commit is contained in:
parent
f2a1ec91f7
commit
067c82c074
@ -33,7 +33,10 @@ class BenchmarkCommand extends Command
|
||||
$vars = IcingaHostVar::loadAll($this->db());
|
||||
Benchmark::measure('vars loaded');
|
||||
foreach ($vars as $var) {
|
||||
if (! array_key_exists($var->host_id, $flat)) continue; // Templates?
|
||||
if (! array_key_exists($var->host_id, $flat)) {
|
||||
// Templates?
|
||||
continue;
|
||||
}
|
||||
$flat[$var->host_id]->{'vars.' . $var->varname} = $var->varvalue;
|
||||
}
|
||||
Benchmark::measure('vars done');
|
||||
|
@ -8,9 +8,8 @@ use Icinga\Module\Director\KickstartHelper;
|
||||
/**
|
||||
* Kickstart a Director installation
|
||||
*
|
||||
* Once you prepared your DB resource and created
|
||||
* This command retrieves information about unapplied database migration and
|
||||
* helps applying them.
|
||||
* Once you prepared your DB resource this command retrieves information about
|
||||
* unapplied database migration and helps applying them.
|
||||
*/
|
||||
class KickstartCommand extends Command
|
||||
{
|
||||
|
@ -120,8 +120,10 @@ class ConfigController extends ActionController
|
||||
{
|
||||
$config = IcingaConfig::generate($this->db());
|
||||
$this->redirectNow(
|
||||
Url::fromPath('director/config/show',
|
||||
array('checksum' => $config->getHexChecksum()))
|
||||
Url::fromPath(
|
||||
'director/config/show',
|
||||
array('checksum' => $config->getHexChecksum())
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,9 @@ class HostController extends ObjectController
|
||||
{
|
||||
$this->getTabs()->activate('services');
|
||||
$this->view->title = $this->translate('Services');
|
||||
$this->view->table = $this->loadTable('IcingaService')->enforceFilter('host_id', $this->object->id)->setConnection($this->db());
|
||||
$this->view->table = $this->loadTable('IcingaService')
|
||||
->enforceFilter('host_id', $this->object->id)
|
||||
->setConnection($this->db());
|
||||
$this->render('objects/table', null, true);
|
||||
}
|
||||
|
||||
@ -61,10 +63,18 @@ class HostController extends ObjectController
|
||||
{
|
||||
$host = $this->object;
|
||||
$db = $this->db();
|
||||
if ($host->object_type !== 'object') return;
|
||||
if ($host->getResolvedProperty('has_agent') !== 'y') return;
|
||||
if ($host->object_type !== 'object') {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($host->getResolvedProperty('has_agent') !== 'y') {
|
||||
return;
|
||||
}
|
||||
|
||||
$name = $host->object_name;
|
||||
if (IcingaEndpoint::exists($name, $db)) continue;
|
||||
if (IcingaEndpoint::exists($name, $db)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$props = array(
|
||||
'object_name' => $name,
|
||||
|
@ -66,7 +66,8 @@ class ImportsourceController extends ActionController
|
||||
$id = $this->params->get('source_id');
|
||||
$this->prepareTabs($id)->activate('modifier');
|
||||
|
||||
$this->view->addLink = $this->view->icon('plus') . ' '
|
||||
$this->view->addLink = $this->view->icon('plus')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
$this->translate('Add property modifier'),
|
||||
'director/importsource/addmodifier',
|
||||
@ -74,7 +75,9 @@ class ImportsourceController extends ActionController
|
||||
);
|
||||
|
||||
$this->view->title = $this->translate('Property modifiers');
|
||||
$this->view->table = $this->loadTable('propertymodifier')->enforceFilter(Filter::where('source_id', $id))->setConnection($this->db());
|
||||
$this->view->table = $this->loadTable('propertymodifier')
|
||||
->enforceFilter(Filter::where('source_id', $id))
|
||||
->setConnection($this->db());
|
||||
$this->render('list/table', null, true);
|
||||
}
|
||||
|
||||
@ -129,7 +132,10 @@ class ImportsourceController extends ActionController
|
||||
$tabs = $this->prepareTabs($source_id)->activate('modifier');
|
||||
|
||||
$this->view->title = $this->translate('Modifier'); // add/edit
|
||||
$this->view->table = $this->loadTable('propertymodifier')->enforceFilter(Filter::where('source_id', $source_id))->setConnection($this->db());
|
||||
$this->view->table = $this->loadTable('propertymodifier')
|
||||
->enforceFilter(Filter::where('source_id', $source_id))
|
||||
->setConnection($this->db());
|
||||
|
||||
$this->render('list/table', null, true);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,8 @@ class InspectController extends ActionController
|
||||
public function statusAction()
|
||||
{
|
||||
$this->view->status = $status = $this->api()->getStatus();
|
||||
print_r($status); exit;
|
||||
print_r($status);
|
||||
exit;
|
||||
}
|
||||
|
||||
protected function api($endpointName = null)
|
||||
|
@ -25,7 +25,7 @@ class ListController extends ActionController
|
||||
$this->view->title = $this->translate('Deployments');
|
||||
$this->prepareTable('deploymentLog');
|
||||
try {
|
||||
|
||||
// Move elsewhere
|
||||
$this->view->table->setActiveStageName(
|
||||
$this->api()->getActiveStageName()
|
||||
);
|
||||
@ -57,7 +57,8 @@ class ListController extends ActionController
|
||||
|
||||
public function datalistAction()
|
||||
{
|
||||
$this->view->addLink = $this->view->icon('plus') . ' '
|
||||
$this->view->addLink = $this->view->icon('plus')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
$this->translate('Add list'),
|
||||
'director/datalist/add'
|
||||
@ -73,7 +74,8 @@ class ListController extends ActionController
|
||||
$listId = $this->params->get('list_id');
|
||||
$this->view->lastId = $listId;
|
||||
|
||||
$this->view->addLink = $this->view->icon('plus') . ' '
|
||||
$this->view->addLink = $this->view->icon('plus')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
$this->translate('Add entry'),
|
||||
'director/datalistentry/add' . '?list_id=' . $listId
|
||||
@ -93,7 +95,8 @@ class ListController extends ActionController
|
||||
|
||||
public function datafieldAction()
|
||||
{
|
||||
$this->view->addLink = $this->view->icon('plus') . ' '
|
||||
$this->view->addLink = $this->view->icon('plus')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
$this->translate('Add field'),
|
||||
'director/datafield/add'
|
||||
@ -106,7 +109,8 @@ class ListController extends ActionController
|
||||
|
||||
public function importsourceAction()
|
||||
{
|
||||
$this->view->addLink = $this->view->icon('plus') . ' '
|
||||
$this->view->addLink = $this->view->icon('plus')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
$this->translate('Add import source'),
|
||||
'director/importsource/add'
|
||||
@ -127,7 +131,8 @@ class ListController extends ActionController
|
||||
|
||||
public function syncruleAction()
|
||||
{
|
||||
$this->view->addLink = $this->view->icon('plus') . ' '
|
||||
$this->view->addLink = $this->view->icon('plus')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
$this->translate('Add sync rule'),
|
||||
'director/syncrule/add'
|
||||
@ -155,8 +160,8 @@ class ListController extends ActionController
|
||||
}
|
||||
|
||||
if (in_array('startup.log', $availableFiles)
|
||||
&& in_array('status', $availableFiles))
|
||||
{
|
||||
&& in_array('status', $availableFiles)
|
||||
) {
|
||||
if ($api->getStagedFile($stage, 'status') === '0') {
|
||||
$deployment->startup_succeeded = 'y';
|
||||
} else {
|
||||
|
@ -107,11 +107,12 @@ class ShowController extends ActionController
|
||||
. '</p>';
|
||||
}
|
||||
|
||||
$this->view->output = $error . ' <pre'
|
||||
. ($object->disabled === 'y' ? ' class="disabled"' : '').
|
||||
'>' . $this->view->escape(
|
||||
(string) $object
|
||||
) . '</pre>';
|
||||
$this->view->output = $error
|
||||
. ' <pre'
|
||||
. ($object->disabled === 'y' ? ' class="disabled"' : '')
|
||||
. '>'
|
||||
. $this->view->escape((string) $object)
|
||||
. '</pre>';
|
||||
}
|
||||
|
||||
protected function showInfo($entry)
|
||||
|
@ -75,7 +75,8 @@ class SyncruleController extends ActionController
|
||||
$this->view->stayHere = true;
|
||||
$id = $this->params->get('rule_id');
|
||||
|
||||
$this->view->addLink = $this->view->icon('plus') . ' '
|
||||
$this->view->addLink = $this->view->icon('plus')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
$this->translate('Add sync property rule'),
|
||||
'director/syncrule/addproperty',
|
||||
@ -92,7 +93,9 @@ class SyncruleController extends ActionController
|
||||
))->activate('property');
|
||||
|
||||
$this->view->title = $this->translate('Sync properties: ');
|
||||
$this->view->table = $this->loadTable('syncproperty')->enforceFilter(Filter::where('rule_id', $id))->setConnection($this->db());
|
||||
$this->view->table = $this->loadTable('syncproperty')
|
||||
->enforceFilter(Filter::where('rule_id', $id))
|
||||
->setConnection($this->db());
|
||||
$this->render('list/table', null, true);
|
||||
}
|
||||
|
||||
@ -146,8 +149,9 @@ class SyncruleController extends ActionController
|
||||
$tabs->activate('property');
|
||||
|
||||
$this->view->title = $this->translate('Sync property'); // add/edit
|
||||
$this->view->table = $this->loadTable('syncproperty')->enforceFilter(Filter::where('rule_id', $rule_id))->setConnection($this->db());
|
||||
$this->view->table = $this->loadTable('syncproperty')
|
||||
->enforceFilter(Filter::where('rule_id', $rule_id))
|
||||
->setConnection($this->db());
|
||||
$this->render('list/table', null, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,8 +75,7 @@ class ConfigForm extends QuickForm
|
||||
|
||||
if (! $this->hasBeenSent()) {
|
||||
$hint = $this->translate(
|
||||
'Configuration looks good, you should be ready to %s'
|
||||
. ' Icinga Director'
|
||||
'Configuration looks good, you should be ready to %s Icinga Director'
|
||||
);
|
||||
$link = $this->getView()->qlink(
|
||||
$this->translate('start using'),
|
||||
|
@ -101,9 +101,15 @@ class DirectorDatafieldForm extends DirectorObjectForm
|
||||
$global = array('varname', 'description', 'caption', 'datatype');
|
||||
|
||||
foreach ($this->getElements() as $el) {
|
||||
if ($el->getIgnore()) continue;
|
||||
if ($el->getIgnore()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = $el->getName();
|
||||
if (in_array($name, $global)) continue;
|
||||
if (in_array($name, $global)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$names[$name] = $name;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,8 @@ class IcingaCloneObjectForm extends QuickForm
|
||||
);
|
||||
|
||||
$new = $object::fromPlainObject(
|
||||
$object->toPlainObject($resolve), $object->getConnection()
|
||||
$object->toPlainObject($resolve),
|
||||
$object->getConnection()
|
||||
)->set('object_name', $newname);
|
||||
|
||||
if ($new->store()) {
|
||||
|
@ -38,7 +38,12 @@ class IcingaCommandForm extends DirectorObjectForm
|
||||
$this->addElement('text', 'command', array(
|
||||
'label' => $this->translate('Command'),
|
||||
'required' => ! $this->isTemplate(),
|
||||
'description' => $this->translate('The command Icinga should run. Absolute paths are accepted as provided, relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed. Spaces will lead to separation of command path and standalone arguments. Please note that this means that we do not support spaces in plugin names and paths right now.')
|
||||
'description' => $this->translate(
|
||||
'The command Icinga should run. Absolute paths are accepted as provided,'
|
||||
. ' relative paths are prefixed with "PluginDir + ", similar Constant prefixes are allowed.'
|
||||
. ' Spaces will lead to separation of command path and standalone arguments. Please note that'
|
||||
. ' this means that we do not support spaces in plugin names and paths right now.'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('text', 'timeout', array(
|
||||
|
@ -24,7 +24,10 @@ class IcingaHostForm extends DirectorObjectForm
|
||||
|
||||
$this->addElement('text', 'address', array(
|
||||
'label' => $this->translate('Host address'),
|
||||
'description' => $this->translate('Host address. Usually an IPv4 address, but may be any kind of address your check plugin is able to deal with')
|
||||
'description' => $this->translate(
|
||||
'Host address. Usually an IPv4 address, but may be any kind of address'
|
||||
. ' your check plugin is able to deal with'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('text', 'address6', array(
|
||||
|
@ -92,8 +92,7 @@ class IcingaObjectFieldForm extends DirectorObjectForm
|
||||
if (empty($fields)) {
|
||||
// TODO: show message depending on permissions
|
||||
$msg = $this->translate(
|
||||
'There are no data fields available.'
|
||||
. ' Please ask an administrator to create such'
|
||||
'There are no data fields available. Please ask an administrator to create such'
|
||||
);
|
||||
|
||||
$this->getElement('datafield_id')->addError($msg);
|
||||
|
@ -13,7 +13,8 @@ class KickstartForm extends QuickForm
|
||||
{
|
||||
$this->addHtmlHint(
|
||||
$this->translate(
|
||||
'Your installation of Icinga Director has not yet been prepared for deployments. This kickstart wizard will assist you with setting up the connection to your Icinga 2 server'
|
||||
'Your installation of Icinga Director has not yet been prepared for deployments.'
|
||||
. ' This kickstart wizard will assist you with setting up the connection to your Icinga 2 server'
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -145,7 +145,9 @@ class SyncPropertyForm extends DirectorObjectForm
|
||||
if ($isCustomvar || $destination === 'vars') {
|
||||
$this->addElement('select', 'merge_policy', array(
|
||||
'label' => $this->translate('Merge Policy'),
|
||||
'description' => $this->translate('Whether you want to merge or replace the destination field. Makes no difference for strings'),
|
||||
'description' => $this->translate(
|
||||
'Whether you want to merge or replace the destination field. Makes no difference for strings'
|
||||
),
|
||||
'required' => true,
|
||||
'multiOptions' => $this->optionalEnum(array(
|
||||
'merge' => 'merge',
|
||||
@ -244,7 +246,9 @@ class SyncPropertyForm extends DirectorObjectForm
|
||||
}
|
||||
|
||||
foreach ($dummy->listProperties() as $prop) {
|
||||
if ($prop === 'id') continue;
|
||||
if ($prop === 'id') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: allow those fields, but munge them (store ids)
|
||||
//if (preg_match('~_id$~', $prop)) continue;
|
||||
|
@ -35,8 +35,8 @@ class DeploymentLogTable extends QuickTable
|
||||
}
|
||||
|
||||
if ($this->activeStageName !== null
|
||||
&& $row->stage_name === $this->activeStageName)
|
||||
{
|
||||
&& $row->stage_name === $this->activeStageName
|
||||
) {
|
||||
$classes[] = 'running';
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,13 @@ class GeneratedConfigFileTable extends QuickTable
|
||||
|
||||
protected function getActionUrl($row)
|
||||
{
|
||||
return $this->url('director/config/file', array('config_checksum' => $row->config_checksum, 'file_path' => $row->file_path));
|
||||
return $this->url(
|
||||
'director/config/file',
|
||||
array(
|
||||
'config_checksum' => $row->config_checksum,
|
||||
'file_path' => $row->file_path
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getTitles()
|
||||
|
@ -1,8 +1,11 @@
|
||||
<?php
|
||||
// Avoid complaints about missing namespace and invalid class name
|
||||
// @codingStandardsIgnoreStart
|
||||
|
||||
use Icinga\Module\Director\PlainObjectRenderer;
|
||||
|
||||
class Zend_View_Helper_RenderPlainObject extends Zend_View_Helper_Abstract
|
||||
// @codingStandardsIgnoreEnd
|
||||
{
|
||||
public function renderPlainObject($object)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user