[WIP] Initial commit for qsgen3
This commit is contained in:
31
docs/zsdoc/data/functions/qsgen2/_pages_cache
Normal file
31
docs/zsdoc/data/functions/qsgen2/_pages_cache
Normal file
@ -0,0 +1,31 @@
|
||||
if [[ ${globaldebug} == "true" ]]; then
|
||||
local debug=true
|
||||
else
|
||||
local debug=false
|
||||
fi
|
||||
typeset -A pages_cache
|
||||
|
||||
_list_pages
|
||||
if [[ -f $pages_cache_file ]]; then
|
||||
while IFS=':' read -r name hash; do
|
||||
pages_cache[$name]=$hash
|
||||
if (${debug}) _msg debug "${0:t}_msg_1" " ${pages_cache[${name}]}"
|
||||
done < "$pages_cache_file"
|
||||
fi
|
||||
pages_array=()
|
||||
for file in ${pages_file_array[@]}; do
|
||||
current_hash=$(md5sum "$file" | awk '{print $1}')
|
||||
|
||||
if (${debug}) _msg debug "${0:t}_msg_2" " ${pages_cache[$file]}"
|
||||
if (${debug}) _msg debug "${0:t}_msg_3" " current_cache: ${current_hash}"
|
||||
if [[ ${pages_cache[$file]} != "$current_hash" ]]; then
|
||||
if (${debug}) _msg debug "${0:t}_msg_4" " ${pages_cache[$file]}"
|
||||
if (${debug}) _msg debug "${0:t}_msg_5" " current_cache: ${current_hash}"
|
||||
pages_array+=("$file")
|
||||
pages_cache[$file]=$current_hash
|
||||
fi
|
||||
done
|
||||
: >| "$pages_cache_file"
|
||||
for name in "${(@k)pages_cache}"; do
|
||||
echo "$name:${pages_cache[$name]}" >> "$pages_cache_file"
|
||||
done
|
Reference in New Issue
Block a user