library/Director: fix PSR2 complaints
This commit is contained in:
parent
586c043290
commit
4bc5afb2f8
|
@ -16,7 +16,8 @@ class ActivityLogTable extends QuickTable
|
|||
'id' => 'l.id',
|
||||
'change_time' => 'l.change_time',
|
||||
'author' => 'l.author',
|
||||
'action' => "CONCAT(l.action_name || ' ' || REPLACE(l.object_type, 'icinga_', '') || ' \"' || l.object_name || '\"')"
|
||||
'action' => "CONCAT(l.action_name || ' ' || REPLACE(l.object_type, 'icinga_', '')"
|
||||
. " || ' \"' || l.object_name || '\"')"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -24,8 +25,8 @@ class ActivityLogTable extends QuickTable
|
|||
{
|
||||
return $this->url(
|
||||
'director/show/activitylog',
|
||||
array_merge(array('id' => $row->id), $this->extraParams
|
||||
));
|
||||
array_merge(array('id' => $row->id), $this->extraParams)
|
||||
);
|
||||
}
|
||||
|
||||
public function getTitles()
|
||||
|
|
|
@ -16,7 +16,8 @@ class IcingaEndpointTable extends IcingaObjectTable
|
|||
'id' => 'e.id',
|
||||
'endpoint' => 'e.object_name',
|
||||
'object_type' => 'e.object_type',
|
||||
'host' => "(CASE WHEN e.host IS NULL THEN NULL ELSE CONCAT(e.host || ':' || COALESCE(e.port, 5665)) END)",
|
||||
'host' => "(CASE WHEN e.host IS NULL THEN NULL ELSE"
|
||||
. " CONCAT(e.host || ':' || COALESCE(e.port, 5665)) END)",
|
||||
'zone' => 'z.object_name',
|
||||
);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ $this->provideRestriction(
|
|||
$this->translate('Allow to use only these db resources (comma separated list)')
|
||||
);
|
||||
|
||||
|
||||
$this->provideConfigTab('config', array(
|
||||
'title' => 'Configuration',
|
||||
'url' => 'settings'
|
||||
|
@ -43,4 +42,3 @@ $section->add($this->translate('Config'))
|
|||
->setUrl('director/list/deploymentlog')
|
||||
->setPriority(902)
|
||||
->setRenderer('ConfigHealthItemRenderer');
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@ class RestApiClient
|
|||
}
|
||||
|
||||
curl_setopt_array($curl, $opts);
|
||||
// TODO: request headers, validate status code
|
||||
|
||||
Benchmark::measure('Rest Api, sending ' . $url);
|
||||
$res = curl_exec($curl);
|
||||
|
|
|
@ -14,5 +14,4 @@ abstract class Stream
|
|||
{
|
||||
$this->stream = $stream;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -194,7 +194,10 @@ abstract class CustomVariable implements IcingaConfigRenderer
|
|||
return $this->toConfigString();
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e);
|
||||
$previousHandler = set_exception_handler(function () {});
|
||||
$previousHandler = set_exception_handler(
|
||||
function () {
|
||||
}
|
||||
);
|
||||
restore_error_handler();
|
||||
call_user_func($previousHandler, $e);
|
||||
die();
|
||||
|
|
|
@ -269,7 +269,10 @@ class CustomVariables implements Iterator, Countable, IcingaConfigRenderer
|
|||
return $this->toConfigString();
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e);
|
||||
$previousHandler = set_exception_handler(function () {});
|
||||
$previousHandler = set_exception_handler(
|
||||
function () {
|
||||
}
|
||||
);
|
||||
restore_error_handler();
|
||||
call_user_func($previousHandler, $e);
|
||||
die();
|
||||
|
|
|
@ -130,7 +130,9 @@ abstract class DbObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function beforeInit() {}
|
||||
protected function beforeInit()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird ausgeführt, nachdem mittels ::factory() ein neues Objekt erstellt
|
||||
|
@ -138,7 +140,9 @@ abstract class DbObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function onFactory() {}
|
||||
protected function onFactory()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird ausgeführt, nachdem mittels ::factory() ein neues Objekt erstellt
|
||||
|
@ -146,7 +150,9 @@ abstract class DbObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function onLoadFromDb() {}
|
||||
protected function onLoadFromDb()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird ausgeführt, bevor ein Objekt abgespeichert wird. Die Operation
|
||||
|
@ -154,14 +160,18 @@ abstract class DbObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function beforeStore() {}
|
||||
protected function beforeStore()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird ausgeführt, nachdem ein Objekt erfolgreich gespeichert worden ist
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function onStore() {}
|
||||
protected function onStore()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird ausgeführt, nachdem ein Objekt erfolgreich der Datenbank hinzu-
|
||||
|
@ -169,7 +179,9 @@ abstract class DbObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function onInsert() {}
|
||||
protected function onInsert()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird ausgeführt, nachdem bestehendes Objekt erfolgreich der Datenbank
|
||||
|
@ -177,7 +189,9 @@ abstract class DbObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function onUpdate() {}
|
||||
protected function onUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird ausgeführt, bevor ein Objekt gelöscht wird. Die Operation wird
|
||||
|
@ -185,7 +199,9 @@ abstract class DbObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function beforeDelete() {}
|
||||
protected function beforeDelete()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Wird ausgeführt, nachdem bestehendes Objekt erfolgreich aud der
|
||||
|
@ -193,7 +209,9 @@ abstract class DbObject
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function onDelete() {}
|
||||
protected function onDelete()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set database connection
|
||||
|
@ -394,7 +412,10 @@ abstract class DbObject
|
|||
{
|
||||
$props = array();
|
||||
foreach (array_keys($this->modifiedProperties) as $key) {
|
||||
if ($key === $this->autoincKeyName) continue;
|
||||
if ($key === $this->autoincKeyName) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$props[$key] = $this->properties[$key];
|
||||
}
|
||||
return $props;
|
||||
|
@ -476,8 +497,7 @@ abstract class DbObject
|
|||
}
|
||||
return $id;
|
||||
} else {
|
||||
if (isset($this->properties[$this->keyName]))
|
||||
{
|
||||
if (isset($this->properties[$this->keyName])) {
|
||||
return $this->properties[$this->keyName];
|
||||
}
|
||||
}
|
||||
|
@ -491,8 +511,7 @@ abstract class DbObject
|
|||
*/
|
||||
public function getAutoincId()
|
||||
{
|
||||
if (isset($this->properties[$this->autoincKeyName]))
|
||||
{
|
||||
if (isset($this->properties[$this->autoincKeyName])) {
|
||||
return $this->properties[$this->autoincKeyName];
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -227,9 +227,13 @@ class Db extends DbConnection
|
|||
public function getLastActivityChecksum()
|
||||
{
|
||||
if ($this->getDbType() === 'pgsql') {
|
||||
$select = "SELECT checksum FROM (SELECT * FROM (SELECT 1 AS pos, LOWER(ENCODE(checksum, 'hex')) AS checksum FROM director_activity_log ORDER BY change_time DESC LIMIT 1) a UNION SELECT 2 AS pos, '' AS checksum) u ORDER BY pos LIMIT 1";
|
||||
$select = "SELECT checksum FROM (SELECT * FROM (SELECT 1 AS pos, LOWER(ENCODE(checksum, 'hex')) AS checksum"
|
||||
. " FROM director_activity_log ORDER BY change_time DESC LIMIT 1) a"
|
||||
. " UNION SELECT 2 AS pos, '' AS checksum) u ORDER BY pos LIMIT 1";
|
||||
} else {
|
||||
$select = "SELECT checksum FROM (SELECT * FROM (SELECT 1 AS pos, LOWER(HEX(checksum)) AS checksum FROM director_activity_log ORDER BY change_time DESC LIMIT 1) a UNION SELECT 2 AS pos, '' AS checksum) u ORDER BY pos LIMIT 1";
|
||||
$select = "SELECT checksum FROM (SELECT * FROM (SELECT 1 AS pos, LOWER(HEX(checksum)) AS checksum"
|
||||
. " FROM director_activity_log ORDER BY change_time DESC LIMIT 1) a"
|
||||
. " UNION SELECT 2 AS pos, '' AS checksum) u ORDER BY pos LIMIT 1";
|
||||
}
|
||||
|
||||
return $this->db()->fetchOne($select);
|
||||
|
|
|
@ -92,7 +92,10 @@ class Migrations
|
|||
$versions = array();
|
||||
|
||||
foreach (new DirectoryIterator($this->getMigrationsDir()) as $file) {
|
||||
if($file->isDot()) continue;
|
||||
if ($file->isDot()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filename = $file->getFilename();
|
||||
if (preg_match('/^upgrade_(\d+)\.sql$/', $filename, $match)) {
|
||||
$versions[] = $match[1];
|
||||
|
|
|
@ -64,7 +64,8 @@ abstract class ImportSourceHook
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getSetting($name, $default = null) {
|
||||
public function getSetting($name, $default = null)
|
||||
{
|
||||
if (array_key_exists($name, $this->settings)) {
|
||||
return $this->settings[$name];
|
||||
} else {
|
||||
|
|
|
@ -277,7 +277,6 @@ class IcingaConfig
|
|||
} catch (Exception $e) {
|
||||
$this->db->rollBack();
|
||||
throw $e;
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -373,10 +372,18 @@ throw $e;
|
|||
$zones = array();
|
||||
$endpoints = array();
|
||||
foreach (IcingaHost::prefetchAll($this->connection) as $host) {
|
||||
if ($host->object_type !== 'object') continue;
|
||||
if ($host->getResolvedProperty('has_agent') !== 'y') continue;
|
||||
if ($host->object_type !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($host->getResolvedProperty('has_agent') !== 'y') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = $host->object_name;
|
||||
if (IcingaEndpoint::exists($name, $this->connection)) continue;
|
||||
if (IcingaEndpoint::exists($name, $this->connection)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$props = array(
|
||||
'object_name' => $name,
|
||||
|
@ -411,18 +418,24 @@ throw $e;
|
|||
protected function createFileForObjects($type, $objects)
|
||||
{
|
||||
Benchmark::measure(sprintf('Generating %d %s', count($objects), $type));
|
||||
if (empty($objects)) return $this;
|
||||
if (empty($objects)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$masterZone = $this->connection->getMasterZoneName();
|
||||
$globalZone = $this->connection->getDefaultGlobalZoneName();
|
||||
$file = null;
|
||||
|
||||
foreach ($objects as $object) {
|
||||
if ($object->disabled === 'y') continue;
|
||||
if ($object->disabled === 'y') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($object->isExternal()) {
|
||||
if ($type === 'zone') {
|
||||
$this->zoneMap[$object->id] = $object->object_name;
|
||||
}
|
||||
|
||||
continue;
|
||||
} elseif ($object->isTemplate()) {
|
||||
$filename = strtolower($type) . '_templates';
|
||||
|
@ -557,6 +570,7 @@ throw $e;
|
|||
}
|
||||
|
||||
// TODO: wipe unused files
|
||||
// DELETE f FROM director_generated_file f left join director_generated_config_file cf ON f.checksum = cf.file_checksum WHERE cf.file_checksum IS NULL;
|
||||
|
||||
// DELETE f FROM director_generated_file f
|
||||
// LEFT JOIN director_generated_config_file cf ON f.checksum = cf.file_checksum
|
||||
// WHERE cf.file_checksum IS NULL;
|
||||
}
|
||||
|
|
|
@ -455,7 +455,9 @@ class Sync
|
|||
) as $object) {
|
||||
|
||||
if ($object instanceof IcingaService) {
|
||||
if (! $object->host_id) continue;
|
||||
if (! $object->host_id) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$key = $this->fillVariables(
|
||||
|
@ -502,7 +504,9 @@ class Sync
|
|||
$imports = array();
|
||||
|
||||
foreach ($this->syncProperties as $p) {
|
||||
if ($p->source_id !== $sourceId) continue;
|
||||
if ($p->source_id !== $sourceId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$prop = $p->destination_field;
|
||||
$val = $this->fillVariables($p->source_expression, $row);
|
||||
|
|
|
@ -261,7 +261,10 @@ class IcingaArguments implements Iterator, Countable, IcingaConfigRenderer
|
|||
return $this->toConfigString();
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e);
|
||||
$previousHandler = set_exception_handler(function () {});
|
||||
$previousHandler = set_exception_handler(
|
||||
function () {
|
||||
}
|
||||
);
|
||||
restore_error_handler();
|
||||
if ($previousHandler !== null) {
|
||||
call_user_func($previousHandler, $e);
|
||||
|
|
|
@ -31,9 +31,19 @@ class IcingaCommand extends IcingaObject
|
|||
|
||||
protected static $pluginDir;
|
||||
|
||||
/**
|
||||
* Render the 'medhods_execute' property as 'execute'
|
||||
*
|
||||
* Execute is a reserved word in SQL, column name was prefixed
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderMethods_execute()
|
||||
{
|
||||
// Execute is a reserved word in SQL, column name was prefixed
|
||||
// @codingStandardsIgnoreEnd
|
||||
return c::renderKeyValue('execute', $this->methods_execute);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,13 +58,31 @@ class IcingaEndpoint extends IcingaObject
|
|||
return new CoreApi($client);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use duration time renderer helper
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderLog_duration()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return $this->renderPropertyAsSeconds('log_duration');
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal property, will not be rendered
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderApiuser_id()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,18 +112,37 @@ class IcingaHost extends IcingaObject
|
|||
return $this->getResolvedProperty('check_command_id') !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal property, will not be rendered
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderHas_Agent()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal property, will not be rendered
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderMaster_should_connect()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal property, will not be rendered
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderAccept_config()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -483,7 +483,9 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
$origins = $object->$getOrigins();
|
||||
|
||||
foreach ($object->$getInherited() as $key => $value) {
|
||||
if (in_array($key, $blacklist)) continue;
|
||||
if (in_array($key, $blacklist)) {
|
||||
continue;
|
||||
}
|
||||
// $vals[$name]->$key = $value;
|
||||
$vals['_MERGED_']->$key = $value;
|
||||
$vals['_INHERITED_']->$key = $value;
|
||||
|
@ -500,7 +502,9 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
}
|
||||
|
||||
foreach ($this->$get() as $key => $value) {
|
||||
if ($value === null) continue;
|
||||
if ($value === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// $vals[$this->object_name]->$key = $value;
|
||||
$vals['_MERGED_']->$key = $value;
|
||||
|
@ -807,8 +811,12 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
|
||||
foreach ($this->properties as $key => $value) {
|
||||
|
||||
if ($value === null) continue;
|
||||
if (in_array($key, $blacklist)) continue;
|
||||
if ($value === null) {
|
||||
continue;
|
||||
}
|
||||
if (in_array($key, $blacklist)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$method = 'render' . ucfirst($key);
|
||||
if (method_exists($this, $method)) {
|
||||
|
@ -821,8 +829,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
c::renderBoolean($value)
|
||||
);
|
||||
}
|
||||
} elseif (
|
||||
substr($key, -3) === '_id'
|
||||
} elseif (substr($key, -3) === '_id'
|
||||
&& $this->hasRelation($relKey = substr($key, 0, -3))
|
||||
) {
|
||||
$out .= $this->renderRelationProperty($relKey, $value);
|
||||
|
@ -949,9 +956,17 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* We do not render zone properties, objects are stored to zone dirs
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderZone_id()
|
||||
{
|
||||
// We do not render zone properties, objects are stored to zone dirs
|
||||
// @codingStandardsIgnoreEnd
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -1194,11 +1209,17 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
}
|
||||
|
||||
if ($skipDefaults) {
|
||||
if (empty($props['imports'])) unset($props['imports']);
|
||||
if (array_key_exists('vars', $props)) {
|
||||
if (count((array) $props['vars']) === 0) unset($props['vars']);
|
||||
if (empty($props['imports'])) {
|
||||
unset($props['imports']);
|
||||
}
|
||||
if (array_key_exists('vars', $props)) {
|
||||
if (count((array) $props['vars']) === 0) {
|
||||
unset($props['vars']);
|
||||
}
|
||||
}
|
||||
if (empty($props['groups'])) {
|
||||
unset($props['groups']);
|
||||
}
|
||||
if (empty($props['groups'])) unset($props['groups']);
|
||||
}
|
||||
|
||||
ksort($props);
|
||||
|
@ -1278,7 +1299,10 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
return $this->toConfigString();
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e);
|
||||
$previousHandler = set_exception_handler(function () {});
|
||||
$previousHandler = set_exception_handler(
|
||||
function () {
|
||||
}
|
||||
);
|
||||
restore_error_handler();
|
||||
if ($previousHandler !== null) {
|
||||
call_user_func($previousHandler, $e);
|
||||
|
|
|
@ -317,7 +317,10 @@ class IcingaObjectGroups implements Iterator, Countable, IcingaConfigRenderer
|
|||
return $this->toConfigString();
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e);
|
||||
$previousHandler = set_exception_handler(function () {});
|
||||
$previousHandler = set_exception_handler(
|
||||
function () {
|
||||
}
|
||||
);
|
||||
restore_error_handler();
|
||||
if ($previousHandler !== null) {
|
||||
call_user_func($previousHandler, $e);
|
||||
|
|
|
@ -300,7 +300,10 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
|
|||
return $this->toConfigString();
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e);
|
||||
$previousHandler = set_exception_handler(function () {});
|
||||
$previousHandler = set_exception_handler(
|
||||
function () {
|
||||
}
|
||||
);
|
||||
restore_error_handler();
|
||||
if ($previousHandler !== null) {
|
||||
call_user_func($previousHandler, $e);
|
||||
|
|
|
@ -78,32 +78,70 @@ class IcingaService extends IcingaObject
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render host_id as host_name
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderHost_id()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return $this->renderRelationProperty('host', $this->host_id, 'host_name');
|
||||
}
|
||||
|
||||
protected function renderCustomExtensions()
|
||||
{
|
||||
if ($this->command_endpoint_id !== null) return '';
|
||||
if ($this->object_type !== 'object') return '';
|
||||
if ($this->getResolvedProperty('use_agent') !== 'y') return '';
|
||||
if ($this->command_endpoint_id !== null
|
||||
|| $this->object_type !== 'object'
|
||||
|| $this->getResolvedProperty('use_agent') !== 'y') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->renderRelationProperty('host', $this->host_id, 'command_endpoint');
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not render internal property
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function renderUse_agent()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Use duration time renderer helper
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderCheck_Interval()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return $this->renderPropertyAsSeconds('check_interval');
|
||||
}
|
||||
|
||||
/**
|
||||
* Use duration time renderer helper
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function renderRetry_Interval()
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
return $this->renderPropertyAsSeconds('retry_interval');
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,10 @@ class IcingaTimePeriodRanges implements Iterator, Countable, IcingaConfigRendere
|
|||
return $this->toConfigString();
|
||||
} catch (Exception $e) {
|
||||
trigger_error($e);
|
||||
$previousHandler = set_exception_handler(function () {});
|
||||
$previousHandler = set_exception_handler(
|
||||
function () {
|
||||
}
|
||||
);
|
||||
restore_error_handler();
|
||||
if ($previousHandler !== null) {
|
||||
call_user_func($previousHandler, $e);
|
||||
|
|
|
@ -25,8 +25,7 @@ class IcingaUser extends IcingaObject
|
|||
|
||||
protected $supportsImports = true;
|
||||
|
||||
protected function renderEnable_notifications()
|
||||
{
|
||||
return $this->renderBooleanProperty('enable_notifications');
|
||||
}
|
||||
protected $booleans = array(
|
||||
'enable_notifications'x => 'enable_notifications'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -34,5 +34,4 @@ class ImportSource extends DbObjectWithSettings
|
|||
->order('priority DESC')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,19 @@ class SyncProperty extends DbObject
|
|||
'merge_policy' => null
|
||||
);
|
||||
|
||||
/**
|
||||
* Virtual property for source_column
|
||||
*
|
||||
* Internally we always use an expression. Form indirectly uses this
|
||||
*
|
||||
* Avoid complaints for method names with underscore:
|
||||
* @codingStandardsIgnoreStart
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setSource_column($value)
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
$this->source_expression = '${' . $value . '}';
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ class PlainObjectRenderer
|
|||
|
||||
protected static function renderArray($array, $prefix = '')
|
||||
{
|
||||
if (empty($array)) return '[]';
|
||||
if (empty($array)) {
|
||||
return '[]';
|
||||
}
|
||||
|
||||
$vals = array();
|
||||
|
||||
|
@ -60,7 +62,10 @@ class PlainObjectRenderer
|
|||
{
|
||||
$vals = array();
|
||||
$hash = (array) $hash;
|
||||
if (empty($hash)) return '{}';
|
||||
if (empty($hash)) {
|
||||
return '{}';
|
||||
}
|
||||
|
||||
ksort($hash);
|
||||
foreach ($hash as $key => $val) {
|
||||
$vals[] = $prefix
|
||||
|
|
|
@ -89,36 +89,60 @@ abstract class ActionController extends Controller
|
|||
|
||||
protected function setConfigTabs()
|
||||
{
|
||||
$this->view->tabs = Widget::create('tabs')->add('deploymentlog', array(
|
||||
$this->view->tabs = Widget::create('tabs')->add(
|
||||
'deploymentlog',
|
||||
array(
|
||||
'label' => $this->translate('Deployments'),
|
||||
'url' => 'director/list/deploymentlog')
|
||||
)->add('generatedconfig', array(
|
||||
'url' => 'director/list/deploymentlog'
|
||||
)
|
||||
)->add(
|
||||
'generatedconfig',
|
||||
array(
|
||||
'label' => $this->translate('Configs'),
|
||||
'url' => 'director/list/generatedconfig')
|
||||
)->add('activitylog', array(
|
||||
'url' => 'director/list/generatedconfig'
|
||||
)
|
||||
)->add(
|
||||
'activitylog',
|
||||
array(
|
||||
'label' => $this->translate('Activity Log'),
|
||||
'url' => 'director/list/activitylog')
|
||||
)->add('datalist', array(
|
||||
'url' => 'director/list/activitylog'
|
||||
)
|
||||
)->add(
|
||||
'datalist',
|
||||
array(
|
||||
'label' => $this->translate('Data lists'),
|
||||
'url' => 'director/list/datalist')
|
||||
)->add('datafield', array(
|
||||
'url' => 'director/list/datalist'
|
||||
)
|
||||
)->add(
|
||||
'datafield',
|
||||
array(
|
||||
'label' => $this->translate('Data fields'),
|
||||
'url' => 'director/list/datafield')
|
||||
'url' => 'director/list/datafield'
|
||||
)
|
||||
);
|
||||
return $this->view->tabs;
|
||||
}
|
||||
|
||||
protected function setImportTabs()
|
||||
{
|
||||
$this->view->tabs = Widget::create('tabs')->add('importsource', array(
|
||||
$this->view->tabs = Widget::create('tabs')->add(
|
||||
'importsource',
|
||||
array(
|
||||
'label' => $this->translate('Import source'),
|
||||
'url' => 'director/list/importsource')
|
||||
)->add('importrun', array(
|
||||
'url' => 'director/list/importsource'
|
||||
)
|
||||
)->add(
|
||||
'importrun',
|
||||
array(
|
||||
'label' => $this->translate('Import history'),
|
||||
'url' => 'director/list/importrun')
|
||||
)->add('syncrule', array(
|
||||
'url' => 'director/list/importrun'
|
||||
)
|
||||
)->add(
|
||||
'syncrule',
|
||||
array(
|
||||
'label' => $this->translate('Sync rule'),
|
||||
'url' => 'director/list/syncrule')
|
||||
'url' => 'director/list/syncrule'
|
||||
)
|
||||
);
|
||||
return $this->view->tabs;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,8 @@ abstract class ObjectController extends ActionController
|
|||
$this->view->title = sprintf($this->translate('Modify %s'), ucfirst($ltype));
|
||||
$this->view->form->handleRequest();
|
||||
|
||||
$this->view->actionLinks = $this->view->icon('paste') . ' '
|
||||
$this->view->actionLinks = $this->view->icon('paste')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
sprintf($this->translate('Clone'), $this->translate(ucfirst($ltype))),
|
||||
'director/' . $ltype .'/clone',
|
||||
|
@ -149,7 +150,8 @@ abstract class ObjectController extends ActionController
|
|||
);
|
||||
$this->view->form->handleRequest();
|
||||
|
||||
$this->view->actionLinks = $this->view->icon('left-big') . ' '
|
||||
$this->view->actionLinks = $this->view->icon('left-big')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
sprintf($this->translate('back'), $this->translate(ucfirst($ltype))),
|
||||
'director/' . $ltype,
|
||||
|
|
|
@ -94,7 +94,8 @@ abstract class ObjectsController extends ActionController
|
|||
$addTitle = $this->translate('Add %s');
|
||||
}
|
||||
|
||||
$this->view->addLink = $this->view->icon('plus') . ' '
|
||||
$this->view->addLink = $this->view->icon('plus')
|
||||
. ' '
|
||||
. $this->view->qlink(
|
||||
sprintf($addTitle, $this->translate(ucfirst($ltype))),
|
||||
'director/' . $ltype .'/add',
|
||||
|
|
|
@ -347,7 +347,9 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
}
|
||||
|
||||
// TODO: handle structured vars
|
||||
if (! is_string($value)) continue;
|
||||
if (! is_string($value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Show inheritance information in case we inherited this var:
|
||||
if (isset($inherited->$key)) {
|
||||
|
@ -674,7 +676,10 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
$label = $this->translate('Delete');
|
||||
}
|
||||
|
||||
$el = $this->createElement('submit', $label)->setLabel($label)->setDecorators(array('ViewHelper')); //->removeDecorator('Label');
|
||||
$el = $this->createElement('submit', $label)
|
||||
->setLabel($label)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
//->removeDecorator('Label');
|
||||
|
||||
$this->deleteButtonName = $el->getName();
|
||||
$this->addElement($el);
|
||||
|
@ -689,7 +694,9 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
|
||||
public function shouldBeDeleted()
|
||||
{
|
||||
if (! $this->hasDeleteButton()) return false;
|
||||
if (! $this->hasDeleteButton()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$name = $this->deleteButtonName;
|
||||
return $this->getSentValue($name) === $this->getElement($name)->getLabel();
|
||||
|
@ -878,15 +885,25 @@ abstract class DirectorObjectForm extends QuickForm
|
|||
protected function addCheckExecutionElements()
|
||||
{
|
||||
|
||||
$this->addElement('text', 'check_interval', array(
|
||||
$this->addElement(
|
||||
'text',
|
||||
'check_interval',
|
||||
array(
|
||||
'label' => $this->translate('Check interval'),
|
||||
'description' => $this->translate('Your regular check interval')
|
||||
));
|
||||
)
|
||||
);
|
||||
|
||||
$this->addElement('text', 'retry_interval', array(
|
||||
$this->addElement(
|
||||
'text',
|
||||
'retry_interval',
|
||||
array(
|
||||
'label' => $this->translate('Retry interval'),
|
||||
'description' => $this->translate('Retry interval, will be applied after a state change unless the next hard state is reached')
|
||||
));
|
||||
'description' => $this->translate(
|
||||
'Retry interval, will be applied after a state change unless the next hard state is reached'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->optionalBoolean(
|
||||
'enable_active_checks',
|
||||
|
|
|
@ -352,7 +352,11 @@ abstract class QuickTable implements Paginatable
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$str .= $this->whereToSql($this->mapFilterColumn($filter->getColumn()), $filter->getSign(), $filter->getExpression());
|
||||
$str .= $this->whereToSql(
|
||||
$this->mapFilterColumn($filter->getColumn()),
|
||||
$filter->getSign(),
|
||||
$filter->getExpression()
|
||||
);
|
||||
}
|
||||
|
||||
return $str;
|
||||
|
|
1
run.php
1
run.php
|
@ -21,4 +21,3 @@ $this->provideHook('director/PropertyModifier', $prefix . 'PropertyModifier\\Pro
|
|||
$this->provideHook('director/PropertyModifier', $prefix . 'PropertyModifier\\PropertyModifierStripDomain');
|
||||
$this->provideHook('director/PropertyModifier', $prefix . 'PropertyModifier\\PropertyModifierSubstring');
|
||||
$this->provideHook('director/PropertyModifier', $prefix . 'PropertyModifier\\PropertyModifierUppercase');
|
||||
|
||||
|
|
Loading…
Reference in New Issue