phpcs: mostly new PSR-2 SpacingAfter/Before checks
This commit is contained in:
parent
8cc99f76d0
commit
b7a10d296c
|
@ -110,7 +110,6 @@ class ConfigCommand extends Command
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($api->dumpConfig($config, $db)) {
|
||||
|
|
|
@ -61,7 +61,6 @@ class DataController extends ActionController
|
|||
'url' => 'director/data/listentry' . '?list_id=' . $id,
|
||||
'label' => $this->translate('List entries'),
|
||||
))->activate('editlist');
|
||||
|
||||
} else {
|
||||
$this->view->title = $this->translate('Add');
|
||||
|
||||
|
|
|
@ -6,11 +6,9 @@ use Exception;
|
|||
use Icinga\Exception\NotFoundError;
|
||||
use Icinga\Module\Director\Exception\NestingError;
|
||||
use Icinga\Module\Director\IcingaConfig\AgentWizard;
|
||||
use Icinga\Module\Director\Objects\IcingaEndpoint;
|
||||
use Icinga\Module\Director\Objects\IcingaHost;
|
||||
use Icinga\Module\Director\Objects\IcingaService;
|
||||
use Icinga\Module\Director\Objects\IcingaServiceSet;
|
||||
use Icinga\Module\Director\Objects\IcingaZone;
|
||||
use Icinga\Module\Director\Util;
|
||||
use Icinga\Module\Director\Web\Controller\ObjectController;
|
||||
|
||||
|
@ -167,8 +165,8 @@ class HostController extends ObjectController
|
|||
)->where('hs.host_id = ?', $host->id);
|
||||
|
||||
$sets = IcingaServiceSet::loadAll($db, $query, 'object_name');
|
||||
foreach ($sets as $name => $set) {
|
||||
|
||||
foreach ($sets as $name => $set) {
|
||||
$title = sprintf($this->translate('%s (Service set)'), $name);
|
||||
$table = $this->loadTable('IcingaServiceSetService')
|
||||
->setServiceSet($set)
|
||||
|
@ -337,7 +335,6 @@ class HostController extends ObjectController
|
|||
$wizard->setTicketSalt($this->api()->getTicketSalt());
|
||||
$this->view->windows = $wizard->renderWindowsInstaller();
|
||||
$this->view->linux = $wizard->renderLinuxInstaller();
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->view->ticket = 'ERROR';
|
||||
$this->view->error = sprintf(
|
||||
|
|
|
@ -13,7 +13,7 @@ class ImportsourceController extends ActionController
|
|||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->setAutoRefreshInterval(10);
|
||||
$this->setAutorefreshInterval(10);
|
||||
$id = $this->params->get('id');
|
||||
$this->prepareTabs($id)->activate('show');
|
||||
$source = $this->view->source = ImportSource::load($id, $this->db());
|
||||
|
@ -173,7 +173,6 @@ class ImportsourceController extends ActionController
|
|||
'url' => 'director/importsource/preview' . '?id=' . $id,
|
||||
'label' => $this->translate('Preview'),
|
||||
));
|
||||
|
||||
} else {
|
||||
$tabs->add('add', array(
|
||||
'url' => 'director/importsource/add',
|
||||
|
|
|
@ -23,7 +23,7 @@ class JobsController extends ActionController
|
|||
$this->loadTable('job')
|
||||
->setConnection($this->db())
|
||||
);
|
||||
$this->setViewScript('list/table');
|
||||
|
||||
$this->setViewScript('list/table');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,6 @@ class ServiceController extends ObjectController
|
|||
}
|
||||
|
||||
if ($this->host && $object->usesVarOverrides()) {
|
||||
|
||||
$parent = IcingaService::create(array(
|
||||
'object_type' => 'template',
|
||||
// TODO: => 'myself', -> There is no such import: "myself"
|
||||
|
@ -157,7 +156,6 @@ class ServiceController extends ObjectController
|
|||
if ($object->isTemplate()
|
||||
&& $object->getResolvedProperty('check_command_id')
|
||||
) {
|
||||
|
||||
$this->view->actionLinks .= ' ' . $this->view->qlink(
|
||||
'Create apply-rule',
|
||||
'director/service/add',
|
||||
|
|
|
@ -25,7 +25,6 @@ class SyncruleController extends ActionController
|
|||
|
||||
if ($lastRunId = $rule->getLastSyncRunId()) {
|
||||
$this->loadSyncRun($lastRunId);
|
||||
|
||||
} else {
|
||||
$this->view->run = null;
|
||||
}
|
||||
|
|
|
@ -16,13 +16,11 @@ class DirectorDatafieldForm extends DirectorObjectForm
|
|||
protected function onRequest()
|
||||
{
|
||||
if ($this->hasBeenSent()) {
|
||||
|
||||
if ($this->shouldBeDeleted()) {
|
||||
$varname = $this->getSentValue('varname');
|
||||
if ($cnt = CustomVariables::countAll($varname, $this->getDb())) {
|
||||
$this->askForVariableDeletion($varname, $cnt);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ class DirectorJobForm extends DirectorObjectForm
|
|||
));
|
||||
|
||||
$periods = $this->db->enumTimeperiods();
|
||||
if (!empty($periods)) {
|
||||
|
||||
if (!empty($periods)) {
|
||||
$this->addElement(
|
||||
'select',
|
||||
'timeperiod_id',
|
||||
|
|
|
@ -31,7 +31,6 @@ class IcingaCloneObjectForm extends QuickForm
|
|||
$this->translate('Clone "%s"'),
|
||||
$this->object->getObjectName()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function onSuccess()
|
||||
|
|
|
@ -17,7 +17,6 @@ class IcingaDeleteObjectForm extends QuickForm
|
|||
$this->translate('YES, please delete "%s"'),
|
||||
$this->object->getObjectName()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function onSuccess()
|
||||
|
|
|
@ -26,7 +26,6 @@ class IcingaImportObjectForm extends QuickForm
|
|||
$this->translate('Import external "%s"'),
|
||||
$this->object->object_name
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function onSuccess()
|
||||
|
|
|
@ -93,7 +93,6 @@ class IcingaServiceForm extends DirectorObjectForm
|
|||
$this->setSubmitLabel(
|
||||
$this->translate('Override vars')
|
||||
);
|
||||
|
||||
} else {
|
||||
$this->addElementsToGroup(
|
||||
array('inheritance_hint'),
|
||||
|
@ -360,8 +359,8 @@ class IcingaServiceForm extends DirectorObjectForm
|
|||
'NOTE: only custom variables of type "Array" are eligible.'
|
||||
)
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ class IcingaTimePeriodForm extends DirectorObjectForm
|
|||
'description' => $this->translate('the update method'),
|
||||
'value' => 'LegacyTimePeriod',
|
||||
));
|
||||
|
||||
} else {
|
||||
// TODO: I'd like to skip this for objects inheriting from a template
|
||||
// with a defined update_method. However, unfortunately it's too
|
||||
|
|
|
@ -31,7 +31,6 @@ class IcingaTimePeriodRangeForm extends DirectorObjectForm
|
|||
));
|
||||
|
||||
$this->setButtons();
|
||||
|
||||
}
|
||||
|
||||
public function setTimePeriod(IcingaTimePeriod $period)
|
||||
|
@ -52,9 +51,9 @@ class IcingaTimePeriodRangeForm extends DirectorObjectForm
|
|||
|
||||
if ($this->period->hasBeenModified()) {
|
||||
if (! $object->hasBeenLoadedFromDb()) {
|
||||
|
||||
$this->setHttpResponseCode(201);
|
||||
}
|
||||
|
||||
$msg = sprintf(
|
||||
$object->hasBeenLoadedFromDb()
|
||||
? $this->translate('The %s has successfully been stored')
|
||||
|
@ -63,7 +62,6 @@ class IcingaTimePeriodRangeForm extends DirectorObjectForm
|
|||
);
|
||||
|
||||
$this->period->store($this->db);
|
||||
|
||||
} else {
|
||||
if ($this->isApiRequest()) {
|
||||
$this->setHttpResponseCode(304);
|
||||
|
|
|
@ -29,7 +29,6 @@ class IcingaUserForm extends DirectorObjectForm
|
|||
}
|
||||
|
||||
if (! $this->isTemplate()) {
|
||||
|
||||
$this->addElement('text', 'email', array(
|
||||
'label' => $this->translate('Email'),
|
||||
'description' => $this->translate('The Email address of the user.')
|
||||
|
|
|
@ -20,7 +20,6 @@ class IcingaUserGroupForm extends DirectorObjectForm
|
|||
->addZoneElements()
|
||||
->groupMainProperties()
|
||||
->setButtons();
|
||||
|
||||
}
|
||||
|
||||
protected function addZoneElements()
|
||||
|
|
|
@ -33,7 +33,6 @@ class ImportCheckForm extends QuickForm
|
|||
$this->setSuccessMessage(
|
||||
$this->translate('This Import Source provides modified data')
|
||||
);
|
||||
|
||||
} else {
|
||||
$this->setSuccessMessage(
|
||||
$this->translate(
|
||||
|
|
|
@ -33,7 +33,6 @@ class ImportRunForm extends QuickForm
|
|||
$this->setSuccessMessage(
|
||||
$this->translate('Imported new data from this Import Source')
|
||||
);
|
||||
|
||||
} else {
|
||||
$this->setSuccessMessage(
|
||||
$this->translate(
|
||||
|
|
|
@ -39,7 +39,6 @@ class KickstartForm extends QuickForm
|
|||
}
|
||||
|
||||
if (!$this->migrations()->hasSchema()) {
|
||||
|
||||
$this->addHtmlHint($this->translate(
|
||||
'No database schema has been created yet'
|
||||
), array('name' => 'HINT_schema'));
|
||||
|
@ -50,7 +49,6 @@ class KickstartForm extends QuickForm
|
|||
}
|
||||
|
||||
if ($this->migrations()->hasPendingMigrations()) {
|
||||
|
||||
$this->addHtmlHint($this->translate(
|
||||
'There are pending database migrations'
|
||||
), array('name' => 'HINT_schema'));
|
||||
|
@ -182,7 +180,6 @@ class KickstartForm extends QuickForm
|
|||
|
||||
try {
|
||||
$db->fetchOne('SELECT 1');
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->getElement('resource')
|
||||
->addError('Could not connect to database: ' . $e->getMessage());
|
||||
|
|
|
@ -62,6 +62,5 @@ class SyncCheckForm extends QuickForm
|
|||
} else {
|
||||
$this->addError($this->translate('Checking this sync rule failed'));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,6 @@ class SyncPropertyForm extends DirectorObjectForm
|
|||
}
|
||||
|
||||
$this->setButtons();
|
||||
|
||||
}
|
||||
|
||||
protected function hasSubOption($options, $key)
|
||||
|
|
|
@ -94,7 +94,6 @@ class ActivityLogTable extends QuickTable
|
|||
'director/show/activitylog',
|
||||
array_merge(array('id' => $row->id), $this->extraParams)
|
||||
);
|
||||
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ class IcingaServiceSetServiceTable extends QuickTable
|
|||
);
|
||||
|
||||
return $this->url('director/host/servicesetservice', $params);
|
||||
|
||||
} else {
|
||||
$params = array(
|
||||
'name' => $row->service,
|
||||
|
|
|
@ -35,7 +35,6 @@ class IcingaServiceTable extends QuickTable
|
|||
$params['id'] = $row->id;
|
||||
} else {
|
||||
$params = array('name' => $row->service);
|
||||
|
||||
}
|
||||
|
||||
return $this->url('director/service', $params);
|
||||
|
@ -56,7 +55,6 @@ class IcingaServiceTable extends QuickTable
|
|||
array('class' => 'icon-plus')
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
$htm .= '. Related apply rules: <table class="apply-rules">';
|
||||
foreach ($extra as $service) {
|
||||
|
|
|
@ -73,7 +73,6 @@ class ImportsourceHookTable extends QuickTable
|
|||
public function fetchData()
|
||||
{
|
||||
if ($this->dataCache === null) {
|
||||
|
||||
$query = $this->getBaseQuery()->columns($this->getColumns());
|
||||
|
||||
if ($this->hasLimit() || $this->hasOffset()) {
|
||||
|
|
|
@ -75,7 +75,6 @@ class Zend_View_Helper_FormExtensibleSet extends Zend_View_Helper_FormElement
|
|||
$total = count($value);
|
||||
|
||||
foreach ($value as $val) {
|
||||
|
||||
if ($multiOptions !== null) {
|
||||
if (in_array($val, $validOptions)) {
|
||||
$multiOptions = $this->removeOption($multiOptions, $val);
|
||||
|
@ -129,7 +128,6 @@ class Zend_View_Helper_FormExtensibleSet extends Zend_View_Helper_FormElement
|
|||
$elements[] = $htm;
|
||||
}
|
||||
} else {
|
||||
|
||||
$elements[] = '<li><input type="text"'
|
||||
. ' name="' . $name . '[]"'
|
||||
. ($cnt === 0 ? '' : ' class="extend-set"')
|
||||
|
|
|
@ -135,7 +135,6 @@ class RestApiClient
|
|||
|
||||
if (! $raw) {
|
||||
$headers[] = 'Accept: application/json';
|
||||
|
||||
}
|
||||
|
||||
if ($body !== null) {
|
||||
|
|
|
@ -214,11 +214,8 @@ abstract class CustomVariable implements IcingaConfigRenderer
|
|||
}
|
||||
|
||||
if (is_string($value)) {
|
||||
|
||||
return new CustomVariableString($key, $value);
|
||||
|
||||
} elseif (is_array($value)) {
|
||||
|
||||
foreach (array_keys($value) as $k) {
|
||||
if (! (is_int($k) || ctype_digit($k))) {
|
||||
return new CustomVariableDictionary($key, $value);
|
||||
|
@ -226,11 +223,9 @@ abstract class CustomVariable implements IcingaConfigRenderer
|
|||
}
|
||||
|
||||
return new CustomVariableArray($key, array_values($value));
|
||||
|
||||
} elseif (is_object($value)) {
|
||||
// TODO: check for specific class/stdClass/interface?
|
||||
return new CustomVariableDictionary($key, $value);
|
||||
|
||||
} else {
|
||||
throw new ProgrammingError('WTF (%s): %s', $key, var_export($value, 1));
|
||||
}
|
||||
|
|
|
@ -246,7 +246,6 @@ abstract class Dashlet
|
|||
} else {
|
||||
$msg = $view->translate('One object has been defined');
|
||||
}
|
||||
|
||||
} else {
|
||||
$msg = sprintf(
|
||||
$view->translate('%d objects have been defined'),
|
||||
|
@ -256,13 +255,13 @@ abstract class Dashlet
|
|||
|
||||
$extra = array();
|
||||
if ($stat->cnt_total !== $stat->cnt_object) {
|
||||
|
||||
if ($stat->cnt_template > 0) {
|
||||
$extra[] = sprintf(
|
||||
$view->translate('%d of them are templates'),
|
||||
$stat->cnt_template
|
||||
);
|
||||
}
|
||||
|
||||
if ($stat->cnt_external > 0) {
|
||||
$extra[] = sprintf(
|
||||
$view->translate(
|
||||
|
|
|
@ -90,7 +90,6 @@ class DeploymentDashlet extends Dashlet
|
|||
if ($cnt === 0) {
|
||||
$msgs[] = $this->translate('There are no pending changes');
|
||||
} else {
|
||||
|
||||
$msgs[] = sprintf(
|
||||
$this->translate(
|
||||
'A total of %d config changes happened since your last'
|
||||
|
|
|
@ -579,7 +579,6 @@ abstract class DbObject
|
|||
$properties = $this->db->fetchRow($select);
|
||||
|
||||
if (empty($properties)) {
|
||||
|
||||
if (is_array($this->getKeyName())) {
|
||||
throw new NotFoundError(
|
||||
'Failed to load %s for %s',
|
||||
|
@ -654,7 +653,6 @@ abstract class DbObject
|
|||
$properties,
|
||||
$this->createWhere()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -749,7 +747,6 @@ abstract class DbObject
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
if ($e instanceof IE) {
|
||||
throw $e;
|
||||
|
@ -1001,7 +998,6 @@ abstract class DbObject
|
|||
self::$prefetchStats[$class]->miss++;
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
self::$prefetchStats[$class]->miss++;
|
||||
return false;
|
||||
|
|
|
@ -124,7 +124,6 @@ abstract class DbObjectWithSettings extends DbObject
|
|||
->from($this->settingsTable, array('setting_name', 'setting_value'))
|
||||
->where($this->settingsRemoteId . ' = ?', $this->get('id'))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
protected function onLoadFromDb()
|
||||
|
|
|
@ -221,7 +221,6 @@ class IcingaObjectQuery
|
|||
if (! $this->hasAlias($alias . $cnt)) {
|
||||
return $alias . $cnt;
|
||||
}
|
||||
|
||||
} while (! $this->hasAlias($alias));
|
||||
|
||||
return $alias;
|
||||
|
|
|
@ -41,7 +41,6 @@ class CustomVariableCache
|
|||
);
|
||||
|
||||
foreach ($db->fetchAll($query) as $row) {
|
||||
|
||||
$id = $row->id;
|
||||
unset($row->id);
|
||||
|
||||
|
|
|
@ -46,9 +46,7 @@ class Migration
|
|||
$db->exec($query);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
throw new IcingaException(
|
||||
'Migration %d failed (%s) while running %s',
|
||||
$this->version,
|
||||
|
|
|
@ -92,7 +92,6 @@ class AssignRenderer
|
|||
$column,
|
||||
$expression
|
||||
);
|
||||
|
||||
} elseif ($filter instanceof FilterMatch) {
|
||||
if (strpos($expression, '*') === false) {
|
||||
return $this->renderEquals($column, $expression);
|
||||
|
@ -103,7 +102,6 @@ class AssignRenderer
|
|||
$column
|
||||
);
|
||||
}
|
||||
|
||||
} elseif ($filter instanceof FilterMatchNot) {
|
||||
if (strpos($expression, '*') === false) {
|
||||
return sprintf(
|
||||
|
@ -118,42 +116,36 @@ class AssignRenderer
|
|||
$column
|
||||
);
|
||||
}
|
||||
|
||||
} elseif ($filter instanceof FilterNotEqual) {
|
||||
return sprintf(
|
||||
'%s != %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
|
||||
return sprintf(
|
||||
'%s != %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
} elseif ($filter instanceof FilterEqualOrGreaterThan) {
|
||||
return sprintf(
|
||||
'%s >= %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
|
||||
return sprintf(
|
||||
'%s >= %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
} elseif ($filter instanceof FilterEqualOrLessThan) {
|
||||
return sprintf(
|
||||
'%s <= %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
|
||||
return sprintf(
|
||||
'%s <= %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
} elseif ($filter instanceof FilterGreaterThan) {
|
||||
return sprintf(
|
||||
'%s > %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
|
||||
return sprintf(
|
||||
'%s > %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
} elseif ($filter instanceof FilterLessThan) {
|
||||
return sprintf(
|
||||
'%s < %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
|
||||
return sprintf(
|
||||
'%s < %s',
|
||||
$column,
|
||||
$expression
|
||||
);
|
||||
} else {
|
||||
throw new QueryException(
|
||||
'Filter expression of type "%s" is not supported',
|
||||
|
|
|
@ -61,8 +61,8 @@ class ExtensibleSet
|
|||
{
|
||||
if (null === $set) {
|
||||
$this->reset();
|
||||
return $this;
|
||||
|
||||
return $this;
|
||||
} elseif (is_array($set) || is_string($set)) {
|
||||
$this->reset();
|
||||
$this->override($set);
|
||||
|
|
|
@ -457,7 +457,6 @@ class IcingaConfig
|
|||
ini_set('zend.enable_gc', 0);
|
||||
|
||||
if (! $this->connection->isPgsql() && $this->db->quote("1\0") !== '\'1\\0\'') {
|
||||
|
||||
throw new IcingaException(
|
||||
'Refusing to render the configuration, your DB layer corrupts binary data.'
|
||||
. ' You might be affected by Zend Framework bug #655'
|
||||
|
|
|
@ -158,7 +158,6 @@ class IcingaConfigHelper
|
|||
|
||||
// Prefix for toConfigString?
|
||||
return "{\n" . implode("\n", $vals) . "\n}";
|
||||
|
||||
}
|
||||
|
||||
public static function renderExpression($string)
|
||||
|
|
|
@ -287,7 +287,6 @@ class Import
|
|||
$db->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
if ($this->isEmpty()) {
|
||||
$newRows = array();
|
||||
$newProperties = array();
|
||||
|
|
|
@ -276,9 +276,7 @@ class Sync
|
|||
json_encode($row)
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (! property_exists($row, $key)) {
|
||||
throw new IcingaException(
|
||||
'There is no key column "%s" in this row from "%s": %s',
|
||||
|
@ -287,7 +285,6 @@ class Sync
|
|||
json_encode($row)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (! $this->rule->matches($row)) {
|
||||
|
@ -339,7 +336,6 @@ class Sync
|
|||
{
|
||||
// TODO: Make object_type (template, object...) and object_name mandatory?
|
||||
if ($this->rule->hasCombinedKey()) {
|
||||
|
||||
$this->objects = array();
|
||||
$destinationKeyPattern = $this->rule->getDestinationKeyPattern();
|
||||
|
||||
|
@ -347,7 +343,6 @@ class Sync
|
|||
$this->rule->object_type,
|
||||
$this->db
|
||||
) as $object) {
|
||||
|
||||
if ($object instanceof IcingaService) {
|
||||
if (strstr($destinationKeyPattern, '${host}') && $object->host_id === null) {
|
||||
continue;
|
||||
|
@ -608,9 +603,9 @@ class Sync
|
|||
$this->run->set('duration_ms', (int) round(
|
||||
(microtime(true) - $this->runStartTime) * 1000
|
||||
))->store();
|
||||
|
||||
} catch (Exception $e) {
|
||||
$dba->rollBack();
|
||||
|
||||
if ($object !== null && $object instanceof IcingaObject) {
|
||||
throw new IcingaException(
|
||||
'Exception while syncing %s %s: %s',
|
||||
|
|
|
@ -114,7 +114,6 @@ class ConfigJob extends JobHook
|
|||
} catch (Exception $e) {
|
||||
// Ignore those errors, Icinga may be reloading
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new IcingaException('Failed to deploy config "%s"', $checksum);
|
||||
}
|
||||
|
@ -129,7 +128,6 @@ class ConfigJob extends JobHook
|
|||
{
|
||||
if ($this->isWithinGracePeriod()) {
|
||||
if ($deployment = $this->lastDeployment()) {
|
||||
|
||||
return $deployment->getDeploymentTimestamp()
|
||||
+ $this->getSetting('grace_period')
|
||||
- time();
|
||||
|
|
|
@ -112,7 +112,6 @@ class KickstartHelper
|
|||
protected function apiUser()
|
||||
{
|
||||
if ($this->apiUser === null) {
|
||||
|
||||
$name = $this->getValue('username');
|
||||
|
||||
$user = IcingaApiUser::create(array(
|
||||
|
@ -217,7 +216,6 @@ class KickstartHelper
|
|||
|
||||
$endpoints = array();
|
||||
foreach ($this->api()->setDb($db)->getEndpointObjects() as $object) {
|
||||
|
||||
if ($object->object_name === $master) {
|
||||
$apiuser = $this->apiUser();
|
||||
$apiuser->store();
|
||||
|
@ -257,7 +255,6 @@ class KickstartHelper
|
|||
try {
|
||||
$this->switchToDeploymentApi()->getStatus();
|
||||
} catch (Exception $e) {
|
||||
|
||||
throw new ConfigurationError(
|
||||
'I was unable to re-establish a connection to the Endpoint "%s" (%s:%d).'
|
||||
. ' When reconnecting to the configured Endpoint (%s:%d) I get an error: %s'
|
||||
|
|
|
@ -55,7 +55,6 @@ class IcingaHostGroup extends IcingaObjectGroup
|
|||
$file = $this->legacyZoneHostgroupFile($config);
|
||||
$this->properties['members'] = array();
|
||||
$file->addLegacyObject($this);
|
||||
|
||||
} else {
|
||||
$allMembers = array();
|
||||
|
||||
|
|
|
@ -151,7 +151,6 @@ class IcingaNotification extends IcingaObject
|
|||
c::renderString($this->getObjectName()),
|
||||
ucfirst($to)
|
||||
);
|
||||
|
||||
} else {
|
||||
return parent::renderObjectHeader();
|
||||
}
|
||||
|
|
|
@ -2378,7 +2378,6 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
}
|
||||
|
||||
foreach ($p as $k => $v) {
|
||||
|
||||
// Do not ship ids for IcingaObjects:
|
||||
if ($resolveIds) {
|
||||
if ($k === 'id' && $this->hasProperty('object_name')) {
|
||||
|
@ -2389,7 +2388,6 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
$relKey = substr($k, 0, -3);
|
||||
|
||||
if ($this->hasRelation($relKey)) {
|
||||
|
||||
if ($this->hasUnresolvedRelatedProperty($k)) {
|
||||
$v = $this->$relKey;
|
||||
} elseif ($v !== null) {
|
||||
|
@ -2419,7 +2417,6 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
} else {
|
||||
$props[$k] = $v;
|
||||
}
|
||||
|
||||
} else {
|
||||
$props[$k] = $v;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,6 @@ class IcingaObjectGroups implements Iterator, Countable, IcingaConfigRenderer
|
|||
$unset = array();
|
||||
|
||||
foreach ($group as $k => $g) {
|
||||
|
||||
if ($g instanceof $class) {
|
||||
$new[] = $g->object_name;
|
||||
} else {
|
||||
|
@ -174,10 +173,9 @@ class IcingaObjectGroups implements Iterator, Countable, IcingaConfigRenderer
|
|||
|
||||
if ($group instanceof $class) {
|
||||
$this->groups[$group->object_name] = $group;
|
||||
|
||||
} elseif (is_string($group)) {
|
||||
|
||||
$connection = $this->object->getConnection();
|
||||
|
||||
try {
|
||||
$this->groups[$group] = $class::load($group, $connection);
|
||||
} catch (NotFoundError $e) {
|
||||
|
|
|
@ -118,8 +118,8 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
|
|||
{
|
||||
$list = array();
|
||||
$class = $this->getImportClass();
|
||||
foreach ($imports as $i) {
|
||||
|
||||
foreach ($imports as $i) {
|
||||
if ($i instanceof $class) {
|
||||
$list[] = $i->object_name;
|
||||
} else {
|
||||
|
|
|
@ -110,7 +110,6 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
|
|||
$unset = array();
|
||||
|
||||
foreach ($relation as $k => $ro) {
|
||||
|
||||
if ($ro instanceof $class) {
|
||||
$new[] = $ro->object_name;
|
||||
} else {
|
||||
|
@ -187,9 +186,7 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
|
|||
|
||||
if ($relation instanceof $class) {
|
||||
$this->relations[$relation->object_name] = $relation;
|
||||
|
||||
} elseif (is_string($relation)) {
|
||||
|
||||
$connection = $this->object->getConnection();
|
||||
try {
|
||||
// Related services can only be objects, used by ServiceSets
|
||||
|
@ -202,7 +199,6 @@ class IcingaObjectMultiRelations implements Iterator, Countable, IcingaConfigRen
|
|||
$relation = $class::load($relation, $connection);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
switch ($onError) {
|
||||
case 'autocreate':
|
||||
$relation = $class::create(array(
|
||||
|
|
|
@ -260,8 +260,8 @@ class IcingaService extends IcingaObject
|
|||
{
|
||||
if ($this->isApplyRule()
|
||||
&& !$this->hasBeenAssignedToHostTemplate()
|
||||
&& $this->get('apply_for') !== null) {
|
||||
|
||||
&& $this->get('apply_for') !== null
|
||||
) {
|
||||
$name = $this->getObjectName();
|
||||
$extraName = '';
|
||||
|
||||
|
@ -280,6 +280,7 @@ class IcingaService extends IcingaObject
|
|||
$this->get('apply_for')
|
||||
) . $extraName;
|
||||
}
|
||||
|
||||
return parent::renderObjectHeader();
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ class IcingaServiceSet extends IcingaObject
|
|||
return sprintf($comment, $this->getObjectName());
|
||||
}
|
||||
|
||||
protected function copyVarsToService(IcingaService $service)
|
||||
public function copyVarsToService(IcingaService $service)
|
||||
{
|
||||
$serviceVars = $service->vars();
|
||||
|
||||
|
@ -208,7 +208,6 @@ class IcingaServiceSet extends IcingaObject
|
|||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
foreach ($this->getServiceObjects() as $service) {
|
||||
$service->set('object_type', 'object');
|
||||
$service->set('host_id', $this->get('host_id'));
|
||||
|
|
|
@ -86,7 +86,6 @@ class IcingaTemplateResolver
|
|||
$object = $this->object;
|
||||
|
||||
if ($object->hasBeenLoadedFromDb()) {
|
||||
|
||||
if ($object->gotImports() && $object->imports()->hasBeenModified()) {
|
||||
return $this->listUnstoredParentIds();
|
||||
}
|
||||
|
@ -121,11 +120,9 @@ class IcingaTemplateResolver
|
|||
$this->requireTemplates();
|
||||
|
||||
if ($name === null) {
|
||||
|
||||
$object = $this->object;
|
||||
|
||||
if ($object->hasBeenLoadedFromDb()) {
|
||||
|
||||
if ($object->gotImports() && $object->imports()->hasBeenModified()) {
|
||||
return $this->listUnstoredParentNames();
|
||||
}
|
||||
|
|
|
@ -213,7 +213,6 @@ class ImportSource extends DbObjectWithSettings
|
|||
}
|
||||
|
||||
$this->last_error_message = null;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$this->import_state = 'failing';
|
||||
Benchmark::measure('Import failed for ' . $this->source_name);
|
||||
|
|
|
@ -154,7 +154,6 @@ class SyncRule extends DbObject
|
|||
}
|
||||
|
||||
$hadChanges = true;
|
||||
|
||||
} else {
|
||||
Benchmark::measure('No modifications for sync rule ' . $this->get('rule_name'));
|
||||
$this->set('sync_state', 'in-sync');
|
||||
|
@ -255,7 +254,6 @@ class SyncRule extends DbObject
|
|||
public function hasCombinedKey()
|
||||
{
|
||||
if ($this->hasCombinedKey === null) {
|
||||
|
||||
$this->hasCombinedKey = false;
|
||||
|
||||
// TODO: Move to Objects
|
||||
|
@ -341,7 +339,6 @@ class SyncRule extends DbObject
|
|||
|
||||
$this->destinationKeyPattern = '${list_id}!${entry_name}';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ class StartupLogRenderer
|
|||
$markPattern = null;
|
||||
// len [stage] + 1
|
||||
$markReplace = ' ^';
|
||||
foreach (preg_split('/\n/', $log) as $line) {
|
||||
|
||||
foreach (preg_split('/\n/', $log) as $line) {
|
||||
if (preg_match($sevPattern, $line, $m)) {
|
||||
$severity = $m[1];
|
||||
$line = preg_replace(
|
||||
|
|
|
@ -62,6 +62,5 @@ class TestSuiteStyle extends TestSuite
|
|||
echo $out ."\n";
|
||||
echo file_get_contents($out);
|
||||
unlink($out);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,7 +265,6 @@ abstract class ActionController extends Controller
|
|||
$filter = $filterEditor->getFilter();
|
||||
|
||||
if ($filter->isEmpty()) {
|
||||
|
||||
if ($this->params->get('modifyFilter')) {
|
||||
$this->view->addLink .= ' ' . $this->view->qlink(
|
||||
$this->translate('Show unfiltered'),
|
||||
|
@ -287,9 +286,7 @@ abstract class ActionController extends Controller
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$this->view->addLink .= ' ' . $this->view->qlink(
|
||||
$this->shorten($filter, 32),
|
||||
$this->getRequest()->getUrl()->with('modifyFilter', true),
|
||||
|
|
|
@ -282,7 +282,6 @@ abstract class ObjectController extends ActionController
|
|||
null,
|
||||
array('class' => 'icon-left-big')
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
$form->handleRequest();
|
||||
|
|
|
@ -479,11 +479,10 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
{
|
||||
$object = $this->object();
|
||||
if ($object->hasBeenModified()) {
|
||||
|
||||
if (! $object->hasBeenLoadedFromDb()) {
|
||||
|
||||
$this->setHttpResponseCode(201);
|
||||
}
|
||||
|
||||
$msg = sprintf(
|
||||
$object->hasBeenLoadedFromDb()
|
||||
? $this->translate('The %s has successfully been stored')
|
||||
|
@ -603,7 +602,6 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
$post = $values = $this->getRequest()->getPost();
|
||||
|
||||
foreach ($post as $key => $value) {
|
||||
|
||||
if (preg_match('/^(.+?)_(\d+)__(MOVE_DOWN|MOVE_UP|REMOVE)$/', $key, $m)) {
|
||||
$values[$m[1]] = array_filter($values[$m[1]], 'strlen');
|
||||
switch ($m[3]) {
|
||||
|
@ -779,7 +777,6 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
|
||||
if (!$this->hasObject()) {
|
||||
if ($this->hasBeenSent()) {
|
||||
|
||||
return $this->getSentValue($name, $default);
|
||||
} else {
|
||||
if ($this->valueIsEmpty($val = $this->getValue($name))) {
|
||||
|
@ -1105,8 +1102,8 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
);
|
||||
|
||||
$periods = $this->db->enumTimeperiods();
|
||||
if (!empty($periods)) {
|
||||
|
||||
if (!empty($periods)) {
|
||||
$this->addElement(
|
||||
'select',
|
||||
'check_period_id',
|
||||
|
|
|
@ -61,7 +61,6 @@ class DataFilter extends FormElement
|
|||
} else {
|
||||
$value = $this->arrayToFilter($value);
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
$value = null;
|
||||
// TODO: getFile, getLine
|
||||
|
|
|
@ -223,7 +223,6 @@ class IcingaObjectFieldLoader
|
|||
$filters = array();
|
||||
foreach ($this->fields as $key => $field) {
|
||||
if ($filter = $field->var_filter) {
|
||||
|
||||
$filters[$key] = Filter::fromQueryString($filter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,8 +149,8 @@ abstract class QuickForm extends QuickBaseForm
|
|||
'Fieldset',
|
||||
);
|
||||
}
|
||||
return $this->addDisplayGroup($elements, $name, $options);
|
||||
|
||||
return $this->addDisplayGroup($elements, $name, $options);
|
||||
}
|
||||
|
||||
protected function createIdElement()
|
||||
|
|
|
@ -114,7 +114,6 @@ abstract class QuickTable implements Paginatable
|
|||
$firstCol = true;
|
||||
|
||||
foreach ($this->getTitles() as $key => $title) {
|
||||
|
||||
// Support missing columns
|
||||
if (property_exists($row, $key)) {
|
||||
$val = $row->$key;
|
||||
|
|
|
@ -724,7 +724,6 @@ class IcingaHostTest extends BaseTestCase
|
|||
foreach (DirectorDatafield::loadAll($db, $query, 'id') as $datafield) {
|
||||
$datafield->delete();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue