chg: [internal] Try to remove possible unused methods

pull/7908/head
Jakub Onderka 2021-10-30 19:49:05 +02:00
parent 9ae7d88f23
commit f6deb48d89
2 changed files with 0 additions and 78 deletions

View File

@ -2623,51 +2623,6 @@ class Attribute extends AppModel
return $attribute;
}
private function __createTagSubQuery($tag_id, $blocked = false, $scope = 'Event', $limitAttributeHitsTo = 'event')
{
$conditionKey = $blocked ? array('NOT' => array('EventTag.tag_id' => $tag_id)) : array('EventTag.tag_id' => $tag_id);
$db = $this->getDataSource();
$subQuery = $db->buildStatement(
array(
'fields' => array($scope . 'Tag.' . $limitAttributeHitsTo . '_id'),
'table' => strtolower($scope) . '_tags',
'alias' => $scope . 'Tag',
'limit' => null,
'offset' => null,
'joins' => array(),
'conditions' => array(
$scope . 'Tag.tag_id' => $tag_id
),
'group' => array($scope . 'Tag.' . $limitAttributeHitsTo . '_id')
),
$this
);
$subQuery = ucfirst($limitAttributeHitsTo) . '.id IN (' . $subQuery . ') ';
$conditions = array(
$db->expression($subQuery)->value
);
return $conditions;
}
public function setTagConditions($tags, $conditions, $limitAttributeHitsTo = 'event')
{
$args = $this->dissectArgs($tags);
$tagArray = $this->AttributeTag->Tag->fetchTagIdsFromFilter($args[0], $args[1]);
$temp = array();
if (!empty($tagArray[0])) {
$temp['OR'][] = $this->__createTagSubQuery($tagArray[0]);
$temp['OR'][] = $this->__createTagSubQuery($tagArray[0], false, 'Attribute', $limitAttributeHitsTo);
}
if (!empty($tagArray[1])) {
$temp['AND']['NOT'] = $this->__createTagSubQuery($tagArray[1], true);
if ($limitAttributeHitsTo == 'attribute') {
$temp['AND']['NOT'] = $this->__createTagSubQuery($tagArray[1], true, 'Attribute', $limitAttributeHitsTo);
}
}
$conditions['AND'][] = $temp;
return $conditions;
}
public function setTimestampConditions($timestamp, $conditions, $scope = 'Event.timestamp', $returnRaw = false)
{
if (is_array($timestamp)) {
@ -2716,16 +2671,6 @@ class Attribute extends AppModel
return $conditions;
}
public function setToIDSConditions($to_ids, $conditions)
{
if ($to_ids === 'exclude') {
$conditions['AND'][] = array('Attribute.to_ids' => 0);
} else {
$conditions['AND'][] = array('Attribute.to_ids' => 1);
}
return $conditions;
}
/**
* Get list of all CIDR for correlation.
* @return array

View File

@ -214,29 +214,6 @@ class Tag extends AppModel
return $this->find('all', array('conditions' => $conditions, 'recursive' => -1));
}
// find all of the tag ids that belong to the accepted tag names and the rejected tag names
public function fetchTagIdsFromFilter($accept = array(), $reject = array())
{
$results = array(0 => array(), 1 => array());
if (!empty($accept)) {
foreach ($accept as $tag) {
$temp = $this->lookupTagIdFromName($tag);
if (!in_array($temp, $results[0])) {
$results[0][] = $temp;
}
}
}
if (!empty($reject)) {
foreach ($reject as $tag) {
$temp = $this->lookupTagIdFromName($tag);
if (!in_array($temp, $results[1])) {
$results[1][] = $temp;
}
}
}
return $results;
}
/**
* @param array $accept
* @param array $reject