mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
CustomVariables: readability, IDE hints
This commit is contained in:
parent
feb80480ea
commit
22eb5911f0
@ -33,7 +33,7 @@ class DirectorDatafieldForm extends DirectorObjectForm
|
||||
}
|
||||
}
|
||||
|
||||
return parent::onRequest();
|
||||
parent::onRequest();
|
||||
}
|
||||
|
||||
protected function askForVariableDeletion($varname, $cnt)
|
||||
|
@ -87,6 +87,10 @@ abstract class CustomVariable implements IcingaConfigRenderer
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return $this
|
||||
*/
|
||||
abstract public function setValue($value);
|
||||
|
||||
abstract public function getValue();
|
||||
|
@ -42,15 +42,12 @@ class CustomVariables implements Iterator, Countable, IcingaConfigRenderer
|
||||
$parts = array();
|
||||
$where = $db->quoteInto('varname = ?', $varname);
|
||||
foreach (static::$allTables as $table) {
|
||||
$parts[] = sprintf(
|
||||
'SELECT COUNT(*) as cnt FROM ' . $table . ' WHERE %s',
|
||||
$where
|
||||
);
|
||||
$parts[] = "SELECT COUNT(*) as cnt FROM $table WHERE $where";
|
||||
}
|
||||
|
||||
$query = 'SELECT SUM(cnt) AS cnt FROM ('
|
||||
. implode(' UNION ALL ', $parts)
|
||||
. ') sub';
|
||||
$sub = implode(' UNION ALL ', $parts);
|
||||
$query = "SELECT SUM(sub.cnt) AS cnt FROM ($sub) sub";
|
||||
|
||||
return (int) $db->fetchOne($query);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user