mirror of
https://github.com/pi-hole/pi-hole
synced 2025-02-15 09:31:59 +00:00
Decide if the content was changed *before* passing over to FTL (#5872)
This commit is contained in:
commit
9212a4a514
10
gravity.sh
10
gravity.sh
@ -813,9 +813,10 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
# Determine if the blocklist was downloaded and saved correctly
|
# Determine if the blocklist was downloaded and saved correctly
|
||||||
if [[ "${success}" == true ]]; then
|
if [[ "${success}" == true ]]; then
|
||||||
if [[ "${httpCode}" == "304" ]]; then
|
if [[ "${httpCode}" == "304" ]]; then
|
||||||
|
# Set list status to "unchanged/cached"
|
||||||
|
database_adlist_status "${adlistID}" "2"
|
||||||
# Add domains to database table file
|
# Add domains to database table file
|
||||||
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
||||||
database_adlist_status "${adlistID}" "2"
|
|
||||||
done="true"
|
done="true"
|
||||||
# Check if $listCurlBuffer is a non-zero length file
|
# Check if $listCurlBuffer is a non-zero length file
|
||||||
elif [[ -s "${listCurlBuffer}" ]]; then
|
elif [[ -s "${listCurlBuffer}" ]]; then
|
||||||
@ -823,10 +824,10 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
gravity_ParseFileIntoDomains "${listCurlBuffer}" "${saveLocation}"
|
gravity_ParseFileIntoDomains "${listCurlBuffer}" "${saveLocation}"
|
||||||
# Remove curl buffer file after its use
|
# Remove curl buffer file after its use
|
||||||
rm "${listCurlBuffer}"
|
rm "${listCurlBuffer}"
|
||||||
|
# Compare lists if are they identical
|
||||||
|
compareLists "${adlistID}" "${saveLocation}"
|
||||||
# Add domains to database table file
|
# Add domains to database table file
|
||||||
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
||||||
# Compare lists, are they identical?
|
|
||||||
compareLists "${adlistID}" "${saveLocation}"
|
|
||||||
done="true"
|
done="true"
|
||||||
else
|
else
|
||||||
# Fall back to previously cached list if $listCurlBuffer is empty
|
# Fall back to previously cached list if $listCurlBuffer is empty
|
||||||
@ -839,9 +840,10 @@ gravity_DownloadBlocklistFromUrl() {
|
|||||||
# Determine if cached list has read permission
|
# Determine if cached list has read permission
|
||||||
if [[ -r "${saveLocation}" ]]; then
|
if [[ -r "${saveLocation}" ]]; then
|
||||||
echo -e " ${CROSS} List download failed: ${COL_LIGHT_GREEN}using previously cached list${COL_NC}"
|
echo -e " ${CROSS} List download failed: ${COL_LIGHT_GREEN}using previously cached list${COL_NC}"
|
||||||
|
# Set list status to "download-failed/cached"
|
||||||
|
database_adlist_status "${adlistID}" "3"
|
||||||
# Add domains to database table file
|
# Add domains to database table file
|
||||||
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
pihole-FTL "${gravity_type}" parseList "${saveLocation}" "${gravityTEMPfile}" "${adlistID}"
|
||||||
database_adlist_status "${adlistID}" "3"
|
|
||||||
else
|
else
|
||||||
echo -e " ${CROSS} List download failed: ${COL_LIGHT_RED}no cached list available${COL_NC}"
|
echo -e " ${CROSS} List download failed: ${COL_LIGHT_RED}no cached list available${COL_NC}"
|
||||||
# Manually reset these two numbers because we do not call parseList here
|
# Manually reset these two numbers because we do not call parseList here
|
||||||
|
Loading…
Reference in New Issue
Block a user