Commit 1df84c3e authored by Ad Schellevis's avatar Ad Schellevis

(filter) ditch alias_get_type()

parent 91de2057
......@@ -46,7 +46,7 @@ function alias_expand_urltable($name) {
if (preg_match("/urltable/i", $alias['type']) && ($alias['name'] == $name)) {
if (is_URL($alias["url"]) && file_exists($urltable_filename) && filesize($urltable_filename)) {
return $urltable_filename;
} elseif (process_alias_urltable($name, $alias["url"], 0, true)) {
} elseif (process_alias_urltable($name, $alias["type"], $alias["url"], 0, true)) {
return $urltable_filename;
}
} elseif ($alias['type'] == 'geoip' && $alias['name'] == $name) {
......@@ -185,7 +185,7 @@ function update_alias_names_upon_change($section, $field, $new_alias_name, $orig
}
}
function process_alias_urltable($name, $url, $freq, $forceupdate = false)
function process_alias_urltable($name, $alias_type, $url, $freq, $forceupdate = false)
{
global $config;
......@@ -211,7 +211,6 @@ function process_alias_urltable($name, $url, $freq, $forceupdate = false)
// todo: rethink alias_expand_urltable in filter.inc , its probably not a very good idea to download and
// process files during boot.
$output_file_handle = fopen($urltable_filename, 'w');
$alias_type = alias_get_type($name);
// Try to fetch the URL supplied
@unlink("{$urltable_filename}.tmp");
$verify_ssl = isset($config['system']['checkaliasesurlcert']);
......
......@@ -1088,21 +1088,6 @@ function is_alias($name)
return array_key_exists($name, $aliastable);
}
function alias_get_type($name)
{
global $config;
if (is_array($config['aliases']['alias'])) {
foreach ($config['aliases']['alias'] as $alias) {
if ($name == $alias['name']) {
return $alias['type'];
}
}
}
return "";
}
/* expand a host or network alias, if necessary */
function alias_expand($name)
{
......
......@@ -36,7 +36,7 @@ if (count($todo) > 0) {
foreach ($todo as $alias) {
if (preg_match('/urltable/i', $alias['type'])) {
log_error("{$argv[0]}: start update {$alias['name']} ");
$r = process_alias_urltable($alias['name'], $alias['url'], $alias['updatefreq']);
$r = process_alias_urltable($alias['name'], $alias['type'], $alias['url'], $alias['updatefreq']);
if ($r == 1) {
if ($alias['type'] == "urltable") {
exec("/sbin/pfctl -t " . escapeshellarg($alias['name']) . " -T replace -f /var/db/aliastables/" . escapeshellarg($alias['name']) . ".txt 2>&1", $result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment