Skip to content

Commit

Permalink
Make alias_update_urltables more robust when urltable aliases are empty
Browse files Browse the repository at this point in the history
ndejong committed May 31, 2020
1 parent a00dd8d commit 742b92e
Showing 1 changed file with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -703,16 +703,22 @@ class fauxApiPfsenseInterface {
$config = $this->config_load($this->config_default_filename);

$urltables = array();
foreach ($config['aliases']['alias'] as $alias) {
if (preg_match('/urltable/i', $alias['type'])) {
$urltables[$alias['name']] = array(
'url' => $alias['url'],
'type' => $alias['type'],
'updatefreq' => $alias['updatefreq']
);
}

if (
array_key_exists('aliases', $config) and
is_array($config['aliases']) and
array_key_exists('aliases', $config['aliases'])) {
foreach ($config['alias']['alias'] as $alias) {
if (preg_match('/urltable/i', $alias['type'])) {
$urltables[$alias['name']] = array(
'url' => $alias['url'],
'type' => $alias['type'],
'updatefreq' => $alias['updatefreq']
);
}
}
}

$updates = array();
foreach ($urltables as $urltablename => $urltable) {
$updates[$urltablename] = array('url' => $urltable['url']);

0 comments on commit 742b92e

Please sign in to comment.