Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions application/controllers/ServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function init()

protected function getOptionalRelatedObjectFromParams($type, $parameter)
{
if ($id = $this->params->get("${parameter}_id")) {
if ($id = $this->params->get("{$parameter}_id")) {
$key = (int) $id;
} else {
$key = $this->params->get($parameter);
Expand All @@ -80,7 +80,7 @@ protected function loadOptionalRelatedObject(IcingaObject $object, $relation)
{
$key = $object->getUnresolvedRelated($relation);
if ($key === null) {
if ($key = $object->get("${relation}_id")) {
if ($key = $object->get("{$relation}_id")) {
$key = (int) $key;
} else {
$key = $object->get($relation);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/SyncruleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ protected function listModifiedProperties($properties)
{
$list = new UnorderedList();
foreach ($properties as $property => $cnt) {
$list->addItem("${cnt}x $property");
$list->addItem("{$cnt}x $property");
}

return $list;
Expand Down
4 changes: 2 additions & 2 deletions application/forms/IcingaCloneObjectForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function onSuccess()
$fields = $db->fetchAll(
$db->select()
->from($table . '_field')
->where("${type}_id = ?", $object->get('id'))
->where("{$type}_id = ?", $object->get('id'))
);
} else {
$fields = [];
Expand Down Expand Up @@ -225,7 +225,7 @@ public function onSuccess()
}

foreach ($fields as $row) {
$row->{"${type}_id"} = $newId;
$row->{"{$type}_id"} = $newId;
$db->insert($table . '_field', (array) $row);
}

Expand Down
4 changes: 2 additions & 2 deletions application/views/helpers/FormDataFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ protected function element(FilterExpression $filter = null)
} elseif (substr($col, $prefixLen, 5) === 'vars.') {
$var = substr($col, $prefixLen + 5);

return $this->text($filter, "DataListValues!${var}");
return $this->text($filter, "DataListValues!{$var}");
}
}

Expand All @@ -236,7 +236,7 @@ protected function selectGroup($type, FilterExpression $filter)
$filter->getExpression(),
[
'class' => 'director-suggest',
'data-suggestion-context' => "${type}groupnames",
'data-suggestion-context' => "{$type}groupnames",
]
);
}
Expand Down
8 changes: 4 additions & 4 deletions application/views/helpers/FormStoredPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*
* We're rendering the following fields:
*
* - ${name}[_value]:
* - ${name}[_sent]:
* - {$name}[_value]:
* - {$name}[_sent]:
*
* Avoid complaints about class names:
* @codingStandardsIgnoreStart
Expand All @@ -26,14 +26,14 @@ public function formStoredPassword($name, $value = null, $attribs = null)
$res = new HtmlDocument();
$el = Html::tag('input', [
'type' => 'password',
'name' => "${name}[_value]",
'name' => "{$name}[_value]",
'id' => $id,
]);
$res->add($el);

$res->add(Html::tag('input', [
'type' => 'hidden',
'name' => "${name}[_sent]",
'name' => "{$name}[_sent]",
'value' => 'y'
]));

Expand Down
2 changes: 1 addition & 1 deletion library/Director/Core/CoreApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ public function getSpecificCommandObjects($type)
{
IcingaCommand::setPluginDir($this->getConstant('PluginDir'));

$objects = $this->getDirectorObjects('Command', "${type}Commands", [
$objects = $this->getDirectorObjects('Command', "{$type}Commands", [
'arguments' => 'arguments',
// 'env' => 'env',
'timeout' => 'timeout',
Expand Down
4 changes: 2 additions & 2 deletions library/Director/Data/FieldReferenceLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public function loadFor(IcingaObject $object)
}
$type = $object->getShortTableName();
$res = $db->fetchAll(
$db->select()->from(['f' => "icinga_${type}_field"], [
$db->select()->from(['f' => "icinga_{$type}_field"], [
'f.datafield_id',
'f.is_required',
'f.var_filter',
])->join(['df' => 'director_datafield'], 'df.id = f.datafield_id', [])
->where("${type}_id = ?", (int) $id)
->where("{$type}_id = ?", (int) $id)
->order('varname ASC')
);

Expand Down
24 changes: 12 additions & 12 deletions library/Director/Db/IcingaObjectFilterHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public static function filterByTemplate(
$db = $template->getDb();
$id = static::wantId($template);
$sub = $db->select()->from(
array($i => "icinga_${type}_inheritance"),
array($i => "icinga_{$type}_inheritance"),
array('e' => '(1)')
)->where("$i.${type}_id = $o.id");
)->where("$i.{$type}_id = $o.id");

if ($inheritanceType === self::INHERIT_DIRECT) {
$sub->where("$i.parent_${type}_id = ?", $id);
$sub->where("$i.parent_{$type}_id = ?", $id);
} elseif ($inheritanceType === self::INHERIT_INDIRECT
|| $inheritanceType === self::INHERIT_DIRECT_OR_INDIRECT
) {
Expand All @@ -72,7 +72,7 @@ public static function filterByTemplate(
if (empty($ids)) {
$sub->where('(1 = 0)');
} else {
$sub->where("$i.parent_${type}_id IN (?)", $ids);
$sub->where("$i.parent_{$type}_id IN (?)", $ids);
}
} else {
throw new RuntimeException(sprintf(
Expand All @@ -95,12 +95,12 @@ public static function filterByHostgroups(
$query->where('(1 = 0)');
} else {
$sub = $query->getAdapter()->select()->from(
array('go' => "icinga_${type}group_${type}"),
array('go' => "icinga_{$type}group_{$type}"),
array('e' => '(1)')
)->join(
array('g' => "icinga_${type}group"),
"go.${type}group_id = g.id"
)->where("go.${type}_id = ${tableAlias}.id")
array('g' => "icinga_{$type}group"),
"go.{$type}group_id = g.id"
)->where("go.{$type}_id = {$tableAlias}.id")
->where('g.object_name IN (?)', $groups);

$query->where('EXISTS ?', $sub);
Expand All @@ -118,13 +118,13 @@ public static function filterByResolvedHostgroups(
$query->where('(1 = 0)');
} else {
$sub = $query->getAdapter()->select()->from(
array('go' => "icinga_${type}group_${type}_resolved"),
array('go' => "icinga_{$type}group_{$type}_resolved"),
array('e' => '(1)')
)->join(
array('g' => "icinga_${type}group"),
"go.${type}group_id = g.id",
array('g' => "icinga_{$type}group"),
"go.{$type}group_id = g.id",
[]
)->where("go.${type}_id = ${tableAlias}.id")
)->where("go.{$type}_id = {$tableAlias}.id")
->where('g.object_name IN (?)', $groups);

$query->where('EXISTS ?', $sub);
Expand Down
2 changes: 1 addition & 1 deletion library/Director/IcingaConfig/AgentWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ protected function replaceBashTemplate($script, $parameters)
} else {
$value = escapeshellarg($value);
}
$script = preg_replace("~^#?$quotedKey='@$quotedKey@'$~m", "${key}=${value}", $script);
$script = preg_replace("~^#?$quotedKey='@$quotedKey@'$~m", "{$key}={$value}", $script);
}

return $script;
Expand Down
30 changes: 15 additions & 15 deletions library/Director/Objects/GroupMembershipResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ protected function getGroupId($name)
$type = $this->type;
if ($this->groupMap === null) {
$this->groupMap = $this->db->fetchPairs(
$this->db->select()->from("icinga_${type}group", ['object_name', 'id'])
$this->db->select()->from("icinga_{$type}group", ['object_name', 'id'])
);
}

Expand Down Expand Up @@ -390,9 +390,9 @@ protected function removeOutdatedMappings()
$db->delete(
$this->getResolvedTableName(),
sprintf(
"(${type}group_id = %d AND ${type}_id = %d)",
$row["${type}group_id"],
$row["${type}_id"]
"({$type}group_id = %d AND {$type}_id = %d)",
$row["{$type}group_id"],
$row["{$type}_id"]
)
);
}
Expand All @@ -416,16 +416,16 @@ protected function getDifference(&$left, &$right)
foreach ($objectIds as $objectId) {
if (! array_key_exists($objectId, $right[$groupId])) {
$diff[] = array(
"${type}group_id" => $groupId,
"${type}_id" => $objectId,
"{$type}group_id" => $groupId,
"{$type}_id" => $objectId,
);
}
}
} else {
foreach ($objectIds as $objectId) {
$diff[] = array(
"${type}group_id" => $groupId,
"${type}_id" => $objectId,
"{$type}group_id" => $groupId,
"{$type}_id" => $objectId,
);
}
}
Expand All @@ -445,16 +445,16 @@ protected function fetchStoredMappings()
$query = $this->db->select()->from(
array('hgh' => $this->getResolvedTableName()),
array(
'group_id' => "${type}group_id",
'object_id' => "${type}_id",
'group_id' => "{$type}group_id",
'object_id' => "{$type}_id",
)
);

$this->addMembershipWhere($query, "${type}_id", $this->objects);
$this->addMembershipWhere($query, "${type}group_id", $this->groups);
$this->addMembershipWhere($query, "{$type}_id", $this->objects);
$this->addMembershipWhere($query, "{$type}group_id", $this->groups);
if (! empty($this->groups)) {
// load staticGroups (we touched here) additionally, so we can compare changes
$this->addMembershipWhere($query, "${type}group_id", $this->staticGroups);
$this->addMembershipWhere($query, "{$type}group_id", $this->staticGroups);
}

foreach ($this->db->fetchAll($query) as $row) {
Expand Down Expand Up @@ -602,7 +602,7 @@ protected function fetchAppliedGroups()
{
$type = $this->getType();
$query = $this->db->select()->from(
array('hg' => "icinga_${type}group"),
array('hg' => "icinga_{$type}group"),
array(
'id',
'assign_filter',
Expand All @@ -629,7 +629,7 @@ protected function parseFilters($list)
protected function getTableName()
{
$type = $this->getType();
return "icinga_${type}group_${type}";
return "icinga_{$type}group_{$type}";
}

protected function getResolvedTableName()
Expand Down
14 changes: 7 additions & 7 deletions library/Director/Objects/IcingaObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -894,20 +894,20 @@ public function getAppliedGroups()

$type = strtolower($this->getType());
$query = $this->db->select()->from(
['gr' => "icinga_${type}group_${type}_resolved"],
['gr' => "icinga_{$type}group_{$type}_resolved"],
['g.object_name']
)->join(
['g' => "icinga_${type}group"],
"g.id = gr.${type}group_id",
['g' => "icinga_{$type}group"],
"g.id = gr.{$type}group_id",
[]
)->joinLeft(
['go' => "icinga_${type}group_${type}"],
"go.${type}group_id = gr.${type}group_id AND go.${type}_id = " . (int) $id,
['go' => "icinga_{$type}group_{$type}"],
"go.{$type}group_id = gr.{$type}group_id AND go.{$type}_id = " . (int) $id,
[]
)->where(
"gr.${type}_id = ?",
"gr.{$type}_id = ?",
(int) $id
)->where("go.${type}_id IS NULL")->order('g.object_name');
)->where("go.{$type}_id IS NULL")->order('g.object_name');

return $this->db->fetchCol($query);
}
Expand Down
6 changes: 3 additions & 3 deletions library/Director/Objects/IcingaServiceSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,13 @@ protected function getConfigHeaderComment(IcingaConfig $config)

if ($config->isLegacy()) {
if ($assign !== null) {
return "## applied Service Set '${name}'\n\n";
return "## applied Service Set '{$name}'\n\n";
} else {
return "## Service Set '${name}' on this host\n\n";
return "## Service Set '{$name}' on this host\n\n";
}
} else {
$comment = [
"Service Set: ${name}",
"Service Set: {$name}",
];

if (($host = $this->get('host')) !== null) {
Expand Down
2 changes: 1 addition & 1 deletion library/Director/Objects/ObjectApplyMatches.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected static function fixFilterExpressionColumn(FilterExpression $filter)
$col = $filter->getColumn();
$type = static::$type;

if ($type && substr($col, 0, strlen($type) + 1) === "${type}.") {
if ($type && substr($col, 0, strlen($type) + 1) === "{$type}.") {
$filter->setColumn($col = substr($col, strlen($type) + 1));
}

Expand Down
4 changes: 2 additions & 2 deletions library/Director/Resolver/CommandUsage.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getLinks()
$suffix = $urlSuffix[$objectType];
$links[] = Link::create(
sprintf($caption, $res->$objectType),
"director/${type}s$suffix",
"director/{$type}s$suffix",
['command' => $name]
);
}
Expand All @@ -96,7 +96,7 @@ protected function fetchFor($table, $rels, $objectTypes)
$query = $this->db->select()->from("icinga_$table", $columns);

foreach ($rels as $rel) {
$query->orWhere("${rel}_id = ?", $id);
$query->orWhere("{$rel}_id = ?", $id);
}

return $this->db->fetchRow($query);
Expand Down
8 changes: 4 additions & 4 deletions library/Director/Resolver/IcingaObjectResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ protected function fetchInheritancePaths($baseTable, $relColumn)
}
$query = $this->db->select()
->from([
'oi' => "${baseTable}_inheritance"
'oi' => "{$baseTable}_inheritance"
], [
$relColumn,
$groupColumn
Expand Down Expand Up @@ -494,12 +494,12 @@ protected function prepareGroupsQuery($resolved = false)
{
$type = $this->getType();
$groupsTable = $this->baseTable . 'group';
$groupMembershipTable = "${groupsTable}_$type";
$groupMembershipTable = "{$groupsTable}_$type";
if ($resolved) {
$groupMembershipTable .= '_resolved';
}
$oRef = "${type}_id";
$gRef = "${type}group_id";
$oRef = "{$type}_id";
$gRef = "{$type}group_id";

return $this->db->select()
->from(['gm' => $groupMembershipTable], [
Expand Down
10 changes: 5 additions & 5 deletions library/Director/Resolver/TemplateTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ protected function loadObjectMaps()
$map = [];
$db = $this->db;
$type = $this->type;
$table = "icinga_${type}_inheritance";
$table = "icinga_{$type}_inheritance";

$query = $db->select()->from(
['i' => $table],
[
'object' => "i.${type}_id",
'parent' => "i.parent_${type}_id",
'object' => "i.{$type}_id",
'parent' => "i.parent_{$type}_id",
]
)->order('i.weight');

Expand Down Expand Up @@ -439,12 +439,12 @@ public function fetchTemplates()

if ($type === 'command') {
$joinCondition = $db->quoteInto(
"p.id = i.parent_${type}_id",
"p.id = i.parent_{$type}_id",
'template'
);
} else {
$joinCondition = $db->quoteInto(
"p.id = i.parent_${type}_id AND p.object_type = ?",
"p.id = i.parent_{$type}_id AND p.object_type = ?",
'template'
);
}
Expand Down
Loading