Teleporter import adds "default" to all domainlist_by_group.json entries.
djadair opened this issue · 1 comments
djadair commented
Versions
- Pi-hole version is v5.18.2 (Latest: v5.18.2)
- web version is v5.21 (Latest: v5.21)
- FTL version is v5.25.2 (Latest: v5.25.2)
Platform
- OS and version: Photon 5.0
- Platform: esxi / docker
Expected behavior
Create new pihole docker instance and import teleporter file from existing instance.
All black/white list domains should be assigned to proper groups.
Actual behavior / bug
Each whitelist domain is assigned to "Default" as well as the desired group.
See: Reddit thread
Steps to reproduce
Steps to reproduce the behavior:
- Stop pihole docker container.
- Remove all existing config
- Start container.
- Load transporter file that contains both whitelists and multiple groups.
- Each whitelist will be a member of both "Default" and groups specified in json file.
Debug Token
Screenshots
Additional context
Work-around seems to be to load the transporter file twice.
Debug log includes diff of transporter.php that corrected the issue. By processing the domainlist_by_group.json file LAST the group membership works properly.
root@photon-5 [ ~ ]# diff -Naur teleporter.orig teleporter.php
--- teleporter.orig 2024-05-08 20:07:55.000000000 +0000
+++ teleporter.php 2024-05-09 02:45:02.254828282 +0000
@@ -451,14 +451,6 @@
$importedsomething = true;
}
- if ((isset($_POST['whitelist']) || isset($_POST['regex_whitelist'])
- || isset($_POST['blacklist']) || isset($_POST['regex_blacklist']))
- && $file->getFilename() === 'domainlist_by_group.json') {
- $num = archive_restore_table($file, 'domainlist_by_group', $flushtables);
- echo 'Processed black-/whitelist group assignments ('.$num.noun($num).")<br>\n";
- $importedsomething = true;
- }
-
if (isset($_POST['adlist']) && $file->getFilename() === 'adlist_by_group.json') {
$num = archive_restore_table($file, 'adlist_by_group', $flushtables);
echo 'Processed adlist group assignments ('.$num.noun($num).")<br>\n";
@@ -550,6 +542,18 @@
}
}
+ foreach (new RecursiveIteratorIterator($archive) as $file) {
+
+ if ((isset($_POST['whitelist']) || isset($_POST['regex_whitelist'])
+ || isset($_POST['blacklist']) || isset($_POST['regex_blacklist']))
+ && $file->getFilename() === 'domainlist_by_group.json') {
+ $num = archive_restore_table($file, 'domainlist_by_group', $flushtables);
+ echo 'Processed black-/whitelist group assignments ('.$num.noun($num).")<br>\n";
+ $importedsomething = true;
+ }
+
+ }
+
// do we need a full restart of Pi-hole or reloading the lists?
if ($fullpiholerestart) {
pihole_execute('restartdns');
github-actions commented
This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.