1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #3321 from tim-moody/7.3.5-misc

handle missing or empty library.xml
This commit is contained in:
Tim Moody 2022-07-26 11:39:03 -04:00 committed by GitHub
commit 15782fb647
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -19,10 +19,16 @@ if flock -n -e 200; then :
# write to {{ kiwix_library_xml }}.tmp to minimize kiwix down
# zim map could be out of sync for a few seconds
# using new version that does deltas
cp $KIWIXLIB $KIWIXLIB.tmp
/usr/bin/iiab-make-kiwix-lib.py
if [ -f $KIWIXLIB ]; then
cp $KIWIXLIB $KIWIXLIB.tmp
/usr/bin/iiab-make-kiwix-lib.py
else
/usr/bin/iiab-make-kiwix-lib.py -f # force rebuild of library.xml
fi
{{ systemctl_program }} stop kiwix-serve
rm $KIWIXLIB
if [ -f $KIWIXLIB ]; then
rm $KIWIXLIB
fi
mv $KIWIXLIB.tmp $KIWIXLIB
{{ systemctl_program }} start kiwix-serve
else

View file

@ -85,8 +85,9 @@ def read_library_xml(lib_xml_file, kiwix_exclude_attr=["favicon"]): # duplicated
attributes[attr] = child.attrib[attr] # copy if not id or in exclusion list
zims_installed[zim_id] = attributes
path_to_id_map[child.attrib['path']] = zim_id
except IOError:
except: # though I try how can I carry on
zims_installed = {}
path_to_id_map = {}
return zims_installed, path_to_id_map
def rem_libr_xml(zim_id, kiwix_library_xml):