1
0
mirror of https://github.com/pi-hole/pi-hole synced 2025-01-09 07:30:56 +00:00

Merge pull request #1702 from pi-hole/fix/activeDomains

Ensure domains files are not deleted upon w/blist
This commit is contained in:
WaLLy3K 2017-09-24 08:02:47 +10:00 committed by GitHub
commit 88b1f0ca7f

View File

@ -181,6 +181,7 @@ gravity_Supernova() {
echo "" echo ""
fi fi
done done
gravity_Blackbody=true
} }
# Download specified URL and perform checks on HTTP status and file content # Download specified URL and perform checks on HTTP status and file content
@ -554,14 +555,17 @@ gravity_Cleanup() {
rm ${piholeDir}/*.tmp 2> /dev/null rm ${piholeDir}/*.tmp 2> /dev/null
rm /tmp/*.phgpb 2> /dev/null rm /tmp/*.phgpb 2> /dev/null
# Remove any unused .domains files # Ensure this function only runs when gravity_Supernova() has completed
for file in ${piholeDir}/*.${domainsExtension}; do if [[ "${gravity_Blackbody:-}" == true ]]; then
# If list is not in active array, then remove it # Remove any unused .domains files
if [[ ! "${activeDomains[*]}" == *"${file}"* ]]; then for file in ${piholeDir}/*.${domainsExtension}; do
rm -f "${file}" 2> /dev/null || \ # If list is not in active array, then remove it
echo -e " ${CROSS} Failed to remove ${file##*/}" if [[ ! "${activeDomains[*]}" == *"${file}"* ]]; then
fi rm -f "${file}" 2> /dev/null || \
done echo -e " ${CROSS} Failed to remove ${file##*/}"
fi
done
fi
echo -e "${OVER} ${TICK} ${str}" echo -e "${OVER} ${TICK} ${str}"