Store timestamp when the gravity table was last updated successfully. This fixes https://github.com/pi-hole/AdminLTE/issues/989

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-09-01 14:42:07 +02:00
parent a7b44426cd
commit ca8982494b
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD

View file

@ -90,6 +90,16 @@ generate_gravity_database() {
chmod g+w "${piholeDir}" "${gravityDBfile}" chmod g+w "${piholeDir}" "${gravityDBfile}"
} }
update_gravity_timestamp() {
# Update timestamp when the gravity table was last updated successfully
output=$( { sqlite3 "${gravityDBfile}" <<< "INSERT OR REPLACE INTO info (property,value) values (\"updated\",cast(strftime('%s', 'now') as int));"; } 2>&1 )
status="$?"
if [[ "${status}" -ne 0 ]]; then
echo -e "\\n ${CROSS} Unable to update gravity timestamp in database ${gravityDBfile}\\n ${output}"
fi
}
# Import domains from file and store them in the specified database table # Import domains from file and store them in the specified database table
database_table_from_file() { database_table_from_file() {
# Define locals # Define locals
@ -749,6 +759,8 @@ fi
gravity_generateLocalList gravity_generateLocalList
gravity_ShowCount gravity_ShowCount
update_gravity_timestamp
gravity_Cleanup gravity_Cleanup
echo "" echo ""